@@ -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