From 68be7ec3b18a6a4c8f8a02a34c60d5f2cbaeee15 Mon Sep 17 00:00:00 2001 From: Philip Bjorge Date: Wed, 2 Aug 2023 17:31:20 -0700 Subject: [PATCH] chore: fix tests --- tests/typing/callable.py | 5 +---- tests/typing/dict.py | 2 +- tests/typing/factory.py | 5 +---- tests/typing/list.py | 5 +---- tests/typing/object.py | 5 +---- tests/typing/provider.py | 2 +- tests/typing/singleton.py | 5 +---- 7 files changed, 7 insertions(+), 22 deletions(-) diff --git a/tests/typing/callable.py b/tests/typing/callable.py index 51c8d3a7..e5bed609 100644 --- a/tests/typing/callable.py +++ b/tests/typing/callable.py @@ -34,10 +34,7 @@ kwargs4: Dict[str, Any] = provider4.kwargs # Test 5: to check the provided instance interface provider5 = providers.Callable(Animal) -provided5: providers.ProvidedInstance = provider5.provided -attr_getter5: providers.AttributeGetter = provider5.provided.attr -item_getter5: providers.ItemGetter = provider5.provided["item"] -method_caller: providers.MethodCaller = provider5.provided.method.call(123, arg=324) +provided5: Animal = provider5.provided # Test 6: to check the DelegatedCallable provider6 = providers.DelegatedCallable(Cat) diff --git a/tests/typing/dict.py b/tests/typing/dict.py index 31205067..73fb53cf 100644 --- a/tests/typing/dict.py +++ b/tests/typing/dict.py @@ -34,7 +34,7 @@ provider5 = providers.Dict( a1=providers.Factory(object), a2=providers.Factory(object), ) -provided5: providers.ProvidedInstance = provider5.provided +provided5: dict[Any, Any] = provider5.provided # Test 6: to check the return type with await diff --git a/tests/typing/factory.py b/tests/typing/factory.py index 132a4c29..831decf0 100644 --- a/tests/typing/factory.py +++ b/tests/typing/factory.py @@ -37,10 +37,7 @@ attributes4: Dict[str, Any] = provider4.attributes # Test 5: to check the provided instance interface provider5 = providers.Factory(Animal) -provided5: providers.ProvidedInstance = provider5.provided -attr_getter5: providers.AttributeGetter = provider5.provided.attr -item_getter5: providers.ItemGetter = provider5.provided["item"] -method_caller5: providers.MethodCaller = provider5.provided.method.call(123, arg=324) +provided5: Animal = provider5.provided # Test 6: to check the DelegatedFactory provider6 = providers.DelegatedFactory(Cat) diff --git a/tests/typing/list.py b/tests/typing/list.py index 3ceae7cc..030978c5 100644 --- a/tests/typing/list.py +++ b/tests/typing/list.py @@ -23,10 +23,7 @@ provider3 = providers.List( providers.Factory(object), providers.Factory(object), ) -provided3: providers.ProvidedInstance = provider3.provided -attr_getter3: providers.AttributeGetter = provider3.provided.attr -item_getter3: providers.ItemGetter = provider3.provided["item"] -method_caller3: providers.MethodCaller = provider3.provided.method.call(123, arg=324) +provided3: List[Any] = provider3.provided # Test 4: to check the return type with await provider4 = providers.List( diff --git a/tests/typing/object.py b/tests/typing/object.py index b099c83b..2c95d309 100644 --- a/tests/typing/object.py +++ b/tests/typing/object.py @@ -9,10 +9,7 @@ var1: int = provider1() # Test 2: to check the provided instance interface provider2 = providers.Object(int) -provided2: providers.ProvidedInstance = provider2.provided -attr_getter2: providers.AttributeGetter = provider2.provided.attr -item_getter2: providers.ItemGetter = provider2.provided["item"] -method_caller2: providers.MethodCaller = provider2.provided.method.call(123, arg=324) +provided2: Type[int] = provider2.provided # Test 3: to check the return type with await provider3 = providers.Object(int(3)) diff --git a/tests/typing/provider.py b/tests/typing/provider.py index 46dd23a0..f4309c8c 100644 --- a/tests/typing/provider.py +++ b/tests/typing/provider.py @@ -3,7 +3,7 @@ from dependency_injector import providers # Test 1: to check .provided attribute provider1: providers.Provider[int] = providers.Object(1) -provided: providers.ProvidedInstance = provider1.provided +provided: int = provider1.provided # Test 2: to check async mode API provider2: providers.Provider = providers.Provider() diff --git a/tests/typing/singleton.py b/tests/typing/singleton.py index badfe1c6..a1ad1bff 100644 --- a/tests/typing/singleton.py +++ b/tests/typing/singleton.py @@ -37,10 +37,7 @@ attributes4: Dict[str, Any] = provider4.attributes # Test 5: to check the provided instance interface provider5 = providers.Singleton(Animal) -provided5: providers.ProvidedInstance = provider5.provided -attr_getter5: providers.AttributeGetter = provider5.provided.attr -item_getter5: providers.ItemGetter = provider5.provided["item"] -method_caller5: providers.MethodCaller = provider5.provided.method.call(123, arg=324) +provided5: Animal = provider5.provided # Test 6: to check the DelegatedSingleton provider6 = providers.DelegatedSingleton(Cat)