@@ -1846,35 +1846,44 @@ def configure(binder):
18461846
18471847def test_annotated_integration_with_annotated ():
18481848 UserID = Annotated [int , 'user_id' ]
1849+ UserAge = Annotated [int , 'user_age' ]
18491850
18501851 @inject
18511852 class TestClass :
1852- def __init__ (self , user_id : UserID ):
1853+ def __init__ (self , user_id : UserID , user_age : UserAge ):
18531854 self .user_id = user_id
1855+ self .user_age = user_age
18541856
18551857 def configure (binder ):
18561858 binder .bind (UserID , to = 123 )
1859+ binder .bind (UserAge , to = 32 )
18571860
18581861 injector = Injector ([configure ])
18591862
18601863 test_class = injector .get (TestClass )
18611864 assert test_class .user_id == 123
1865+ assert test_class .user_age == 32
18621866
18631867
18641868def test_inject_annotation_with_annotated_type ():
18651869 UserID = Annotated [int , 'user_id' ]
1870+ UserAge = Annotated [int , 'user_age' ]
18661871
18671872 class TestClass :
1868- def __init__ (self , user_id : Inject [UserID ]):
1873+ def __init__ (self , user_id : Inject [UserID ], user_age : Inject [ UserAge ] ):
18691874 self .user_id = user_id
1875+ self .user_age = user_age
18701876
18711877 def configure (binder ):
18721878 binder .bind (UserID , to = 123 )
1879+ binder .bind (UserAge , to = 32 )
1880+ binder .bind (int , to = 456 )
18731881
18741882 injector = Injector ([configure ])
18751883
18761884 test_class = injector .get (TestClass )
18771885 assert test_class .user_id == 123
1886+ assert test_class .user_age == 32
18781887
18791888
18801889def test_inject_annotation_with_nested_annotated_type ():
0 commit comments