Coverage for tests / test_tutorial / test_python_types / test_tutorial008b.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1import importlib 1abcd

2from types import ModuleType 1abcd

3from unittest.mock import patch 1abcd

4 

5import pytest 1abcd

6 

7from ...utils import needs_py310 1abcd

8 

9 

10@pytest.fixture( 1abcd

11 name="module", 

12 params=[ 

13 pytest.param("tutorial008b_py310"), 

14 pytest.param("tutorial008b_py310", marks=needs_py310), 

15 ], 

16) 

17def get_module(request: pytest.FixtureRequest): 1abcd

18 mod = importlib.import_module(f"docs_src.python_types.{request.param}") 1mnopqrst

19 return mod 1mnopqrst

20 

21 

22def test_process_items(module: ModuleType): 1abcd

23 with patch("builtins.print") as mock_print: 1efghijkl

24 module.process_item("a") 1efghijkl

25 

26 assert mock_print.call_count == 1 1efghijkl

27 mock_print.assert_called_with("a") 1efghijkl