Updating instance providers example

This commit is contained in:
Roman Mogilatov 2015-05-15 17:44:20 +03:00
parent a5337b2fc8
commit 05b65f432c
2 changed files with 7 additions and 6 deletions

View File

@ -34,10 +34,10 @@ Example:
# Factory provider creates new instance of specified class on every call. # Factory provider creates new instance of specified class on every call.
new_object = Factory(object) object_factory = Factory(object)
object_1 = new_object() object_1 = object_factory()
object_2 = new_object() object_2 = object_factory()
assert object_1 is not object_2 assert object_1 is not object_2
assert isinstance(object_1, object) and isinstance(object_2, object) 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) assert isinstance(object_1, object) and isinstance(object_2, object)
Injections Injections
~~~~~~~~~~ ~~~~~~~~~~

View File

@ -5,10 +5,10 @@ from objects.providers import Singleton
# Factory provider creates new instance of specified class on every call. # Factory provider creates new instance of specified class on every call.
new_object = Factory(object) object_factory = Factory(object)
object_1 = new_object() object_1 = object_factory()
object_2 = new_object() object_2 = object_factory()
assert object_1 is not object_2 assert object_1 is not object_2
assert isinstance(object_1, object) and isinstance(object_2, object) assert isinstance(object_1, object) and isinstance(object_2, object)