Coverage for tests/test_tutorial/test_limit_and_offset/test_tutorial003_py310.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-03-07 05:42 +0000

1from unittest.mock import patch 1kefghij

2 

3from sqlmodel import create_engine 1kefghij

4 

5from ...conftest import get_testing_print_function, needs_py310 1kefghij

6 

7expected_calls = [ 1efghij

8 [ 

9 [ 

10 { 

11 "id": 7, 

12 "name": "Captain North America", 

13 "secret_name": "Esteban Rogelios", 

14 "age": 93, 

15 } 

16 ] 

17 ] 

18] 

19 

20 

21@needs_py310 1kefghij

22def test_tutorial(clear_sqlmodel): 1efghij

23 from docs_src.tutorial.offset_and_limit import tutorial003_py310 as mod 1abcd

24 

25 mod.sqlite_url = "sqlite://" 1abcd

26 mod.engine = create_engine(mod.sqlite_url) 1abcd

27 calls = [] 1abcd

28 

29 new_print = get_testing_print_function(calls) 1abcd

30 

31 with patch("builtins.print", new=new_print): 1abcd

32 mod.main() 1abcd

33 assert calls == expected_calls 1abcd