Open reritom opened 1 month ago
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
Perhaps related to the comment on here about the library not being a real dependency injection system https://github.com/Lancetnik/FastDepends/issues/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.