codestyle: move "statement" out of with block

This commit is contained in:
bronsen 2026-02-22 19:05:37 +01:00
parent 1fdf5cb1d3
commit 4832a0d69b

View file

@ -180,11 +180,12 @@ async def test_data_provided_to_addtodatabase_ends_up_in_database(app_db: Engine
async def test_created_database_contains_expected_tables(engine: Engine):
with engine.connect() as connection:
statement = text("SELECT name from sqlite_schema WHERE type = 'table'")
with engine.connect() as connection:
results = connection.execute(statement).all()
assert len(results) == 0
create_db_and_tables(engine)
results = connection.execute(statement).all()
assert len(results) == 1