summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2014-05-18 15:23:54 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2014-05-18 15:23:54 +0200
commit3d7a00d1c5cafe37e49a716c8ae075e984b3111a (patch)
tree4ca8f17d5b8b1b94fdcb99239c85ad07584ebb84 /docs
parentecde9a5c2f5d7ea230e68e6d0b3586e5956e55c0 (diff)
downloadfactory-boy-3d7a00d1c5cafe37e49a716c8ae075e984b3111a.tar
factory-boy-3d7a00d1c5cafe37e49a716c8ae075e984b3111a.tar.gz
Improve docs on create_batch (Closes #139).
Diffstat (limited to 'docs')
-rw-r--r--docs/examples.rst12
1 files changed, 4 insertions, 8 deletions
diff --git a/docs/examples.rst b/docs/examples.rst
index a57080e..ee521e3 100644
--- a/docs/examples.rst
+++ b/docs/examples.rst
@@ -114,12 +114,9 @@ We can now use our factories, for tests:
def test_get_profile_stats(self):
profiles = []
- for _ in xrange(4):
- profiles.append(factories.ProfileFactory())
- for _ in xrange(2):
- profiles.append(factories.FemaleProfileFactory())
- for _ in xrange(2):
- profiles.append(factories.ProfileFactory(planet='Tatooine'))
+ profiles.extend(factories.ProfileFactory.batch_create(4))
+ profiles.extend(factories.FemaleProfileFactory.batch_create(2))
+ profiles.extend(factories.ProfileFactory.batch_create(2, planet="Tatooine"))
stats = business_logic.profile_stats(profiles)
self.assertEqual({'Earth': 6, 'Mars': 2}, stats.planets)
@@ -133,8 +130,7 @@ Or for fixtures:
from . import factories
def make_objects():
- for _ in xrange(50):
- factories.ProfileFactory()
+ factories.ProfileFactory.batch_create(size=50)
# Let's create a few, known objects.
factories.ProfileFactory(