Skip to content

Commit d1f65ac

Browse files
committed
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 433ef53 commit d1f65ac

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/test_enums.py

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

4748

4849
def test_sqlite_ddl_sql(clear_sqlmodel, capsys: pytest.CaptureFixture[str]):
@@ -52,6 +53,7 @@ def test_sqlite_ddl_sql(clear_sqlmodel, capsys: pytest.CaptureFixture[str]):
5253

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

5759

0 commit comments

Comments
 (0)