Coverage for tests/test_tutorial/test_where/test_tutorial009.py: 100%
12 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 1ghijkl
3from sqlmodel import create_engine 1ghijkl
5from ...conftest import get_testing_print_function 1ghijkl
8def test_tutorial(clear_sqlmodel): 1ghijkl
9 from docs_src.tutorial.where import tutorial009 as mod 1abcdef
11 mod.sqlite_url = "sqlite://" 1abcdef
12 mod.engine = create_engine(mod.sqlite_url) 1abcdef
13 calls = [] 1abcdef
15 new_print = get_testing_print_function(calls) 1abcdef
17 with patch("builtins.print", new=new_print): 1abcdef
18 mod.main() 1abcdef
19 assert calls == [ 1abcdef
20 [{"name": "Tarantula", "secret_name": "Natalia Roman-on", "age": 32, "id": 4}],
21 [{"name": "Black Lion", "secret_name": "Trevor Challa", "age": 35, "id": 5}],
22 [
23 {
24 "name": "Captain North America",
25 "secret_name": "Esteban Rogelios",
26 "age": 93,
27 "id": 7,
28 }
29 ],
30 ]