Coverage for tests/test_tutorial/test_one/test_tutorial006_py310.py: 100%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-27 00:03 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-27 00:03 +0000
1from unittest.mock import patch 1ijklmnopqr
3from sqlmodel import create_engine 1ijklmnopqr
5from ...conftest import get_testing_print_function, needs_py310 1ijklmnopqr
8@needs_py310 1ijklmnopqr
9def test_tutorial(clear_sqlmodel): 1ijklmnopqr
10 from docs_src.tutorial.one import tutorial006_py310 as mod 1abcdefgh
12 mod.sqlite_url = "sqlite://" 1abcdefgh
13 mod.engine = create_engine(mod.sqlite_url) 1abcdefgh
14 calls = [] 1abcdefgh
16 new_print = get_testing_print_function(calls) 1abcdefgh
18 with patch("builtins.print", new=new_print): 1abcdefgh
19 mod.main() 1abcdefgh
20 assert calls == [ 1abcdefgh
21 [
22 "Hero:",
23 {"name": "Deadpond", "secret_name": "Dive Wilson", "age": None, "id": 1},
24 ]
25 ]