Skip to content

Commit

Permalink
chore: #100 pr
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Sep 5, 2024
1 parent 4920b50 commit 4030f98
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fast_depends/core/builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import inspect
from copy import deepcopy
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -102,7 +103,7 @@ def build_call_model(
if isinstance(next_custom, Dependant):
dep = next_custom
elif isinstance(next_custom, CustomField):
custom = next_custom
custom = deepcopy(next_custom)
else: # pragma: no cover
raise AssertionError("unreachable")

Expand Down
15 changes: 15 additions & 0 deletions tests/library/test_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ def __init__(self, key: int = Header()):
assert T(headers={"key": 1}).key == 1


def test_reusable_annotated() -> None:
HeaderKey = Annotated[float, Header(cast=False)]

@inject
def sync_catch(key: HeaderKey) -> float:
return key

@inject
def sync_catch2(key2: HeaderKey) -> float:
return key2

assert sync_catch(headers={"key": 1}) == 1
assert sync_catch2(headers={"key2": 1}) == 1


@serializer
class TestSerializer:
@pytest.mark.anyio
Expand Down

0 comments on commit 4030f98

Please sign in to comment.