From 00b30c65c9dc12c723ad28d54ebaca034e35d68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sun, 29 Oct 2023 12:00:58 +0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Add=20test=20to=20ensure=20sa=5Ftyp?= =?UTF-8?q?e=20is=20not=20passed=20with=20sa=5Fcolumn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_field_sa_column.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_field_sa_column.py b/tests/test_field_sa_column.py index 51cfdfa..7384f1f 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):