Coverage for tests/test_typealiastype_depends/test_typealiastype_depends.py: 100%
22 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-13 05:19 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-13 05:19 +0000
1from typing import Annotated 1abcdefghijklmn
3import pytest 1abcdefghijklmn
5from fast_depends import Depends, inject 1abcdefghijklmn
8@pytest.mark.anyio 1abcdefghijklmn
9async def test_typealiastype_depends_async() -> None: 1abcdefghijklmn
11 async def dep_func(b): 1abcdefghijklmn
12 return b 1abcdefghijklmn
14 type D = Annotated[int, Depends(dep_func)] 1abcdefghijklmn
16 @inject 1abcdefghijklmn
17 async def some_async_func(a: int, b: D) -> int: 1abcdefghijklmn
18 assert isinstance(b, int) 1abcdefghijklmn
19 return a + b 1abcdefghijklmn
21 assert await some_async_func(1, 2) == 3 1abcdefghijklmn
24def test_typealiastype_depends_sync() -> None: 1abcdefghijklmn
25 def dep_func(b): 1abcdefghijklmn
26 return b 1abcdefghijklmn
28 type D = Annotated[int, Depends(dep_func)] 1abcdefghijklmn
30 @inject 1abcdefghijklmn
31 def some_func(a: int, b: D) -> int: 1abcdefghijklmn
32 assert isinstance(b, int) 1abcdefghijklmn
33 return a + b 1abcdefghijklmn
35 assert some_func(1, 2) == 3 1abcdefghijklmn