Coverage for tests/test_tutorial/test_soonify_return/test_tutorial002.py: 100%
14 statements
« prev ^ index » next coverage.py v7.17.2, created at 2026-12-05 11:30 +0000
« prev ^ index » next coverage.py v7.17.2, created at 2026-12-05 11:30 +0000
1from unittest.mock import patch 1lmnopqrstuv
3import asyncer 1lmnopqrstuv
4import pytest 1lmnopqrstuv
6from ...conftest import get_testing_print_function 1lmnopqrstuv
9def test_tutorial(): 1lmnopqrstuv
10 calls = [] 1abcdefghijk
12 new_print = get_testing_print_function(calls) 1abcdefghijk
14 with patch("builtins.print", new=new_print): 1abcdefghijk
15 with pytest.raises((ExceptionGroup, asyncer.PendingValueException)) as e: 1abcdefghijk
16 from docs_src.tutorial.soonify_return import tutorial002 as mod 1abcdefghijk
18 # Avoid autoflake removing this import
19 assert mod # pragma: nocover
20 if isinstance(e.value, ExceptionGroup): 1abcdefghijk
21 assert isinstance(e.value.exceptions[0], asyncer.PendingValueException) 1abcdefgjk
22 else:
23 assert isinstance(e.value, asyncer.PendingValueException) 1hi
24 assert calls == [] 1abcdefghijk