diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -53,7 +53,9 @@ Usage Defining factories """""""""""""""""" -Factories declare a set of attributes used to instantiate an object. The class of the object must be defined in the FACTORY_FOR attribute:: +Factories declare a set of attributes used to instantiate an object. The class of the object must be defined in the FACTORY_FOR attribute: + +.. code-block:: python import factory from . import models @@ -77,7 +79,9 @@ Factories declare a set of attributes used to instantiate an object. The class o Using factories """"""""""""""" -factory_boy supports several different build strategies: build, create, attributes and stub:: +factory_boy supports several different build strategies: build, create, attributes and stub: + +.. code-block:: python # Returns a User instance that's not saved user = UserFactory.build() @@ -89,7 +93,9 @@ factory_boy supports several different build strategies: build, create, attribut attributes = UserFactory.attributes() -You can use the Factory class as a shortcut for the default build strategy:: +You can use the Factory class as a shortcut for the default build strategy: + +.. code-block:: python # Same as UserFactory.create() user = UserFactory() |