python-dependency-injector/examples/speech/factory.py

15 lines
317 B
Python
Raw Normal View History

2016-06-02 20:25:45 +03:00
"""Factory provider example."""
from dependency_injector import providers
object_factory = providers.Factory(object)
2016-06-03 00:47:10 +03:00
2016-06-02 20:25:45 +03:00
if __name__ == '__main__':
object1 = object_factory()
object2 = object_factory()
assert object1 is not object2
assert isinstance(object1, object) and isinstance(object2, object)