Add container usage for object provider example

This commit is contained in:
Roman Mogylatov 2020-09-03 17:00:14 -04:00
parent b074d2aeb7
commit 6528411271

View File

@ -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