File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1325,7 +1325,7 @@ def provide_strs_also(self) -> List[str]:
13251325def _mark_provider_function (function : Callable , * , allow_multi : bool ) -> None :
13261326 scope_ = getattr (function , '__scope__' , None )
13271327 try :
1328- annotations = get_type_hints (function )
1328+ annotations = get_type_hints (function , include_extras = True )
13291329 except NameError :
13301330 return_type = '__deferred__'
13311331 else :
Original file line number Diff line number Diff line change @@ -1767,3 +1767,21 @@ def target(val_foo: foo, val_bar: bar):
17671767 pass
17681768
17691769 assert get_bindings (target ) == {'val_foo' : foo , 'val_bar' : bar }
1770+
1771+
1772+ def test_annotated_injection_from_provider_to_attribute ():
1773+ foo = Annotated [str , "foo" ]
1774+ bar = Annotated [str , "bar" ]
1775+
1776+ class TestModule (Module ):
1777+ @provider
1778+ def provide_foo (self ) -> foo :
1779+ return "foo"
1780+
1781+ @multiprovider
1782+ def provide_bars (self ) -> list [bar ]:
1783+ return ["bar" ]
1784+
1785+ injector = Injector ([TestModule ])
1786+ assert injector .binder .has_explicit_binding_for (foo )
1787+ assert injector .binder .has_explicit_binding_for (list [bar ])
You can’t perform that action at this time.
0 commit comments