Coverage for tests/test_advanced/test_decimal/test_tutorial001.py: 100%
14 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 decimal import Decimal 1lghijk
2from unittest.mock import patch 1lghijk
4from sqlmodel import create_engine 1lghijk
6from ...conftest import get_testing_print_function 1lghijk
8expected_calls = [ 1ghijk
9 [
10 "Hero 1:",
11 {
12 "name": "Deadpond",
13 "age": None,
14 "id": 1,
15 "secret_name": "Dive Wilson",
16 "money": Decimal("1.100"),
17 },
18 ],
19 [
20 "Hero 2:",
21 {
22 "name": "Rusty-Man",
23 "age": 48,
24 "id": 3,
25 "secret_name": "Tommy Sharp",
26 "money": Decimal("2.200"),
27 },
28 ],
29 ["Total money: 3.300"],
30]
33def test_tutorial(clear_sqlmodel): 1lghijk
34 from docs_src.advanced.decimal import tutorial001 as mod 1abcdef
36 mod.sqlite_url = "sqlite://" 1abcdef
37 mod.engine = create_engine(mod.sqlite_url) 1abcdef
38 calls = [] 1abcdef
40 new_print = get_testing_print_function(calls) 1abcdef
42 with patch("builtins.print", new=new_print): 1abcdef
43 mod.main() 1abcdef
44 assert calls == expected_calls 1abcdef