Skip to content

Commit 0b86f18

Browse files
KunxiSunKunxiSun
authored andcommitted
test: Adds tests for integer enum fields
Adds tests to ensure that integer enum fields are correctly handled in both Postgres and SQLite DDL generation.
1 parent a9a45fa commit 0b86f18

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎tests/test_enums.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_postgres_ddl_sql(clear_sqlmodel, capsys: pytest.CaptureFixture[str]):
4242
captured = capsys.readouterr()
4343
assert "CREATE TYPE myenum1 AS ENUM ('A', 'B');" in captured.out
4444
assert "CREATE TYPE myenum2 AS ENUM ('C', 'D');" in captured.out
45+
assert "int_enum_field SMALLINT NOT NULL" in captured.out
4546

4647

4748
def test_sqlite_ddl_sql(clear_sqlmodel, capsys: pytest.CaptureFixture[str]):
@@ -51,6 +52,7 @@ def test_sqlite_ddl_sql(clear_sqlmodel, capsys: pytest.CaptureFixture[str]):
5152

5253
captured = capsys.readouterr()
5354
assert "enum_field VARCHAR(1) NOT NULL" in captured.out, captured
55+
assert "int_enum_field SMALLINT NOT NULL" in captured.out, captured
5456
assert "CREATE TYPE" not in captured.out
5557

5658

0 commit comments

Comments
 (0)