Coverage for tests / test_tutorial / test_where / test_tutorial009.py: 100%
13 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-11-09 00:02 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-11-09 00:02 +0000
1import importlib 1abcdefghi
2from types import ModuleType 1abcdefghi
4import pytest 1abcdefghi
5from sqlalchemy import Engine 1abcdefghi
7from ...conftest import PrintMock 1abcdefghi
10@pytest.fixture( 1abcdefghi
11 name="mod",
12 params=[
13 pytest.param("tutorial009_py310"),
14 ],
15)
16def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: 1abcdefghi
17 mod = importlib.import_module(f"docs_src.tutorial.where.{request.param}") 1abcdefghi
18 mod.engine = database_engine 1abcdefghi
19 return mod 1abcdefghi
22def test_tutorial(print_mock: PrintMock, mod: ModuleType): 1abcdefghi
23 mod.main() 1jklmnopqr
24 assert print_mock.calls == [ 1jklmnopqr
25 [{"name": "Tarantula", "secret_name": "Natalia Roman-on", "age": 32, "id": 4}],
26 [{"name": "Black Lion", "secret_name": "Trevor Challa", "age": 35, "id": 5}],
27 [
28 {
29 "name": "Captain North America",
30 "secret_name": "Esteban Rogelios",
31 "age": 93,
32 "id": 7,
33 }
34 ],
35 ]