From f56d11b9a30ecd0887c03e9891bee31a2ccc41b3 Mon Sep 17 00:00:00 2001 From: Nikita Pastukhov Date: Thu, 5 Sep 2024 23:42:32 +0300 Subject: [PATCH] chore: #115 pr --- tests/async/test_depends.py | 12 ++++++++++++ tests/sync/test_depends.py | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/tests/async/test_depends.py b/tests/async/test_depends.py index f45d860..7ee793d 100644 --- a/tests/async/test_depends.py +++ b/tests/async/test_depends.py @@ -490,3 +490,15 @@ async def another_func( assert await some_func("1", "2") assert await another_func("3") == 6.0 + + +@pytest.mark.anyio +async def test_default_key_value(): + async def dep(a: str = "a"): + return a + + @inject(cast=False) + async def func(a=Depends(dep)): + return a + + assert await func() == "a" diff --git a/tests/sync/test_depends.py b/tests/sync/test_depends.py index 532f78f..8d83003 100644 --- a/tests/sync/test_depends.py +++ b/tests/sync/test_depends.py @@ -376,3 +376,14 @@ def another_func( assert some_func("1", "2") assert another_func("3") == 6.0 + + +def test_default_key_value(): + def dep(a: str = "a"): + return a + + @inject(cast=False) + def func(a=Depends(dep)): + return a + + assert func() == "a"