]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
✅ Add test to ensure sa_type is not passed with sa_column pr/maru0123-2004/505
authorSebastián Ramírez <tiangolo@gmail.com>
Sun, 29 Oct 2023 08:00:58 +0000 (12:00 +0400)
committerSebastián Ramírez <tiangolo@gmail.com>
Sun, 29 Oct 2023 08:00:58 +0000 (12:00 +0400)
tests/test_field_sa_column.py

index 51cfdfa7973c656ed54fa3b6e799432e85adc8c5..7384f1fabcf93f1b9e9856a678630255307b4f76 100644 (file)
@@ -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):