summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index 991180f..9b82406 100644
--- a/README.rst
+++ b/README.rst
@@ -177,6 +177,28 @@ It is also possible to create a bunch of objects in a single call:
>>> [user.first_name for user in users]
["Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe"]
+
+Realistic, random values
+""""""""""""""""""""""""
+
+Tests look better with random yet realistic values.
+For this, factory_boy relies on the excellent `fake-factory <https://pypi.python.org/pypi/fake-factory>`_ library:
+
+.. code-block:: python
+
+ class RandomUserFactory(factory.Factory):
+ class Meta:
+ model = models.User
+
+ first_name = factory.Faker('first_name')
+ last_name = factory.Faker('last_name')
+
+.. code-block:: pycon
+
+ >>> UserFactory()
+ <User: Lucy Murray>
+
+
Lazy Attributes
"""""""""""""""