Coverage for tests / test_tutorial / test_python_types / test_tutorial011.py: 100%
11 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1import runpy 1abcd
2from unittest.mock import patch 1abcd
4import pytest 1abcd
6from ...utils import needs_py310 1abcd
9@pytest.mark.parametrize( 1abcd
10 "module_name",
11 [
12 pytest.param("tutorial011_py310", marks=needs_py310),
13 ],
14)
15def test_run_module(module_name: str): 1abcd
16 with patch("builtins.print") as mock_print: 1efg
17 runpy.run_module(f"docs_src.python_types.{module_name}", run_name="__main__") 1efg
19 assert mock_print.call_count == 2 1efg
20 call_args = [str(arg.args[0]) for arg in mock_print.call_args_list] 1efg
21 assert call_args == [ 1efg
22 "id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3]",
23 "123",
24 ]