mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Add container usage for object provider example
This commit is contained in:
parent
b074d2aeb7
commit
6528411271
|
@ -1,10 +1,14 @@
|
|||
"""`Object` provider example."""
|
||||
|
||||
from dependency_injector import providers
|
||||
from dependency_injector import containers, providers
|
||||
|
||||
|
||||
object_provider = providers.Object(1)
|
||||
class Container(containers.DeclarativeContainer):
|
||||
|
||||
object_provider = providers.Object(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
assert object_provider() == 1
|
||||
container = Container()
|
||||
|
||||
assert container.object_provider() == 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user