Skip to content

Commit 6feb059

Browse files
committed
for demonstration: uncomment part of test using select with 5 fields
1 parent 140d347 commit 6feb059

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/test_select_typing.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ class Hero(SQLModel, table=True):
5151
assert type(hero_4[3]) in [int, type(None)]
5252

5353
# check typing of select with 5 fields: currently runs but doesn't pass mypy
54-
# with Session(engine) as session:
55-
# statement_5 = select(Hero.id, Hero.name, Hero.secret_name, Hero.age, Hero.food)
56-
# results_5 = session.exec(statement_5)
57-
# for hero_5 in results_5:
58-
# assert len(hero_5) == 5
59-
# name_5: str = hero_5[1]
60-
# assert type(name_5) is str
61-
# assert type(hero_5[0]) is int
62-
# assert type(hero_5[2]) is str
63-
# assert type(hero_5[3]) in [int, type(None)]
64-
# assert type(hero_5[4]) in [str, type(None)]
54+
with Session(engine) as session:
55+
statement_5 = select(Hero.id, Hero.name, Hero.secret_name, Hero.age, Hero.food)
56+
results_5 = session.exec(statement_5)
57+
for hero_5 in results_5:
58+
assert len(hero_5) == 5
59+
name_5: str = hero_5[1]
60+
assert type(name_5) is str
61+
assert type(hero_5[0]) is int
62+
assert type(hero_5[2]) is str
63+
assert type(hero_5[3]) in [int, type(None)]
64+
assert type(hero_5[4]) in [str, type(None)]

0 commit comments

Comments
 (0)