mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 01:26:51 +03:00
Updating instance providers example
This commit is contained in:
parent
a5337b2fc8
commit
05b65f432c
|
@ -34,10 +34,10 @@ Example:
|
|||
|
||||
|
||||
# Factory provider creates new instance of specified class on every call.
|
||||
new_object = Factory(object)
|
||||
object_factory = Factory(object)
|
||||
|
||||
object_1 = new_object()
|
||||
object_2 = new_object()
|
||||
object_1 = object_factory()
|
||||
object_2 = object_factory()
|
||||
|
||||
assert object_1 is not object_2
|
||||
assert isinstance(object_1, object) and isinstance(object_2, object)
|
||||
|
@ -53,6 +53,7 @@ Example:
|
|||
assert isinstance(object_1, object) and isinstance(object_2, object)
|
||||
|
||||
|
||||
|
||||
Injections
|
||||
~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ from objects.providers import Singleton
|
|||
|
||||
|
||||
# Factory provider creates new instance of specified class on every call.
|
||||
new_object = Factory(object)
|
||||
object_factory = Factory(object)
|
||||
|
||||
object_1 = new_object()
|
||||
object_2 = new_object()
|
||||
object_1 = object_factory()
|
||||
object_2 = object_factory()
|
||||
|
||||
assert object_1 is not object_2
|
||||
assert isinstance(object_1, object) and isinstance(object_2, object)
|
||||
|
|
Loading…
Reference in New Issue
Block a user