mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-08 22:33:15 +03:00
Add stub for the FactoryAggregate provider
This commit is contained in:
parent
2a609dd54b
commit
39923b3650
|
@ -188,6 +188,14 @@ class FactoryDelegate(Delegate):
|
|||
def __init__(self, factory: Factory): ...
|
||||
|
||||
|
||||
class FactoryAggregate(Provider):
|
||||
def __init__(self, **factories: Factory): ...
|
||||
def __call__(self, factory_name: str, *args: Injection, **kwargs: Injection) -> Any: ...
|
||||
def __getattr__(self, factory_name: str) -> Factory: ...
|
||||
@property
|
||||
def factories(self) -> Dict[str, Factory]: ...
|
||||
|
||||
|
||||
class ProvidedInstanceFluentInterface:
|
||||
def __getattr__(self, item: str) -> AttributeGetter: ...
|
||||
def __getitem__(self, item: str) -> ItemGetter: ...
|
||||
|
|
|
@ -53,3 +53,12 @@ animal7: Animal = provider7(1, 2, 3, b='1', c=2, e=0.0)
|
|||
|
||||
# Test 8: to check the FactoryDelegate __init__
|
||||
provider8 = providers.FactoryDelegate(providers.Factory(object))
|
||||
|
||||
# Test 9: to check FactoryAggregate provider
|
||||
provider9 = providers.FactoryAggregate(
|
||||
a=providers.Factory(object),
|
||||
b=providers.Factory(object),
|
||||
)
|
||||
factory_a_9: providers.Factory = provider9.a
|
||||
factory_b_9: providers.Factory = provider9.b
|
||||
val9: Any = provider9('a')
|
||||
|
|
Loading…
Reference in New Issue
Block a user