-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overridden arguments not considered #98
Labels
bug
Something isn't working
Comments
alexanderlazarev0
pushed a commit
to alexanderlazarev0/FastDepends
that referenced
this issue
Jul 9, 2024
alexanderlazarev0
pushed a commit
to alexanderlazarev0/FastDepends
that referenced
this issue
Jul 9, 2024
The reason this doesn't work seems to be due to the fact that this is supported: def test_class_depends():
class MyDep:
def __init__(self, a: int):
self.a = a
@inject
def some_func(a=Depends(MyDep)):
assert isinstance(a, MyDep)
assert a.a == 3
return a
some_func(3) So also this works: from fast_depends import Depends, inject
def my_dep(a: int):
return a + 5
@inject
def some_func(a=Depends(my_dep)):
return a
some_func(3) # 8 |
alexanderlazarev0
pushed a commit
to alexanderlazarev0/FastDepends
that referenced
this issue
Jul 9, 2024
alexanderlazarev0
pushed a commit
to alexanderlazarev0/FastDepends
that referenced
this issue
Jul 9, 2024
alexanderlazarev0
pushed a commit
to alexanderlazarev0/FastDepends
that referenced
this issue
Jul 13, 2024
alexanderlazarev0
pushed a commit
to alexanderlazarev0/FastDepends
that referenced
this issue
Jul 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perhaps related to the comment on here about the library not being a real dependency injection system #65
Using version 2.4.3
When passing an explicit argument for a parameter defined as a dependency, I would expect the explicit argument to be used and the dependency to be overridden/ignored, but it doesn't seem to be the case.
The text was updated successfully, but these errors were encountered: