Coverage for tests/test_advanced/test_decimal/test_tutorial001_py310.py: 100%
15 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-03-24 00:02 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-03-24 00:02 +0000
1from decimal import Decimal 1efghij
2from unittest.mock import patch 1efghij
4from sqlmodel import create_engine 1efghij
6from ...conftest import get_testing_print_function, needs_py310 1efghij
8expected_calls = [ 1efghij
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]
33@needs_py310 1efghij
34def test_tutorial(clear_sqlmodel): 1efghij
35 from docs_src.advanced.decimal import tutorial001_py310 as mod 1abcd
37 mod.sqlite_url = "sqlite://" 1abcd
38 mod.engine = create_engine(mod.sqlite_url) 1abcd
39 calls = [] 1abcd
41 new_print = get_testing_print_function(calls) 1abcd
43 with patch("builtins.print", new=new_print): 1abcd
44 mod.main() 1abcd
45 assert calls == expected_calls 1abcd