mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
56c9023b2d
* Fix stubs and add tests * Fix tests * Fix stubs
33 lines
809 B
Python
33 lines
809 B
Python
from dependency_injector import containers, providers
|
|
|
|
|
|
# Test 1: to check declarative container subclass
|
|
class Container1(containers.DeclarativeContainer):
|
|
provider = providers.Factory(int)
|
|
|
|
|
|
container1 = Container1()
|
|
container1_type: containers.Container = Container1()
|
|
provider1: providers.Provider = container1.provider
|
|
val1: int = container1.provider(3)
|
|
|
|
|
|
# Test 2: to check @override decorator
|
|
class Container21(containers.DeclarativeContainer):
|
|
provider = providers.Factory(int)
|
|
|
|
|
|
@containers.override(Container21)
|
|
class Container22(containers.DeclarativeContainer):
|
|
...
|
|
|
|
|
|
# Test 3: to check @copy decorator
|
|
class Container31(containers.DeclarativeContainer):
|
|
provider = providers.Factory(int)
|
|
|
|
|
|
@containers.copy(Container31)
|
|
class Container32(containers.DeclarativeContainer):
|
|
...
|