Coverage for tests / test_tutorial / test_limit_and_offset / test_tutorial001.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-11-09 00:02 +0000

1import importlib 1abcdefghi

2from types import ModuleType 1abcdefghi

3 

4import pytest 1abcdefghi

5from sqlalchemy import Engine 1abcdefghi

6 

7from ...conftest import PrintMock 1abcdefghi

8 

9 

10@pytest.fixture( 1abcdefghi

11 name="mod", 

12 params=[ 

13 pytest.param("tutorial001_py310"), 

14 ], 

15) 

16def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: 1abcdefghi

17 mod = importlib.import_module(f"docs_src.tutorial.offset_and_limit.{request.param}") 1abcdefghi

18 mod.engine = database_engine 1abcdefghi

19 return mod 1abcdefghi

20 

21 

22expected_calls = [ 1abcdefghi

23 [ 

24 [ 

25 {"id": 1, "name": "Deadpond", "secret_name": "Dive Wilson", "age": None}, 

26 { 

27 "id": 2, 

28 "name": "Spider-Boy", 

29 "secret_name": "Pedro Parqueador", 

30 "age": None, 

31 }, 

32 {"id": 3, "name": "Rusty-Man", "secret_name": "Tommy Sharp", "age": 48}, 

33 ] 

34 ] 

35] 

36 

37 

38def test_tutorial(print_mock: PrintMock, mod: ModuleType): 1abcdefghi

39 mod.main() 1jklmnopqr

40 assert print_mock.calls == expected_calls 1jklmnopqr