From: Sebastián Ramírez Date: Sun, 29 Oct 2023 08:00:58 +0000 (+0400) Subject: ✅ Add test to ensure sa_type is not passed with sa_column X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fpr%2Fmaru0123-2004%2F505;p=thirdparty%2Ffastapi%2Fsqlmodel.git ✅ Add test to ensure sa_type is not passed with sa_column --- diff --git a/tests/test_field_sa_column.py b/tests/test_field_sa_column.py index 51cfdfa7..7384f1fa 100644 --- a/tests/test_field_sa_column.py +++ b/tests/test_field_sa_column.py @@ -39,6 +39,17 @@ def test_sa_column_no_sa_kargs() -> None: ) +def test_sa_column_no_type() -> None: + with pytest.raises(RuntimeError): + + class Item(SQLModel, table=True): + id: Optional[int] = Field( + default=None, + sa_type=Integer, + sa_column=Column(Integer, primary_key=True), + ) + + def test_sa_column_no_primary_key() -> None: with pytest.raises(RuntimeError):