Coverage for tests/test_tutorial/test_limit_and_offset/test_tutorial001.py: 100%
13 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 00:02 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 00:02 +0000
1from unittest.mock import patch 1lghijk
3from sqlmodel import create_engine 1lghijk
5from ...conftest import get_testing_print_function 1lghijk
7expected_calls = [ 1ghijk
8 [
9 [
10 {"id": 1, "name": "Deadpond", "secret_name": "Dive Wilson", "age": None},
11 {
12 "id": 2,
13 "name": "Spider-Boy",
14 "secret_name": "Pedro Parqueador",
15 "age": None,
16 },
17 {"id": 3, "name": "Rusty-Man", "secret_name": "Tommy Sharp", "age": 48},
18 ]
19 ]
20]
23def test_tutorial(clear_sqlmodel): 1lghijk
24 from docs_src.tutorial.offset_and_limit import tutorial001 as mod 1abcdef
26 mod.sqlite_url = "sqlite://" 1abcdef
27 mod.engine = create_engine(mod.sqlite_url) 1abcdef
28 calls = [] 1abcdef
30 new_print = get_testing_print_function(calls) 1abcdef
32 with patch("builtins.print", new=new_print): 1abcdef
33 mod.main() 1abcdef
34 assert calls == expected_calls 1abcdef