summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2015-03-26 22:22:03 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2015-03-26 22:22:03 +0100
commit69befae5fde1897cf68c4d44a146db5ba642c814 (patch)
tree88d696ef1784cd73552a5ecd13bc3f4af5d2ac2a /docs
parent40d4a4b13d4ca959879d1798f24d510fd7abf4dc (diff)
downloadfactory-boy-69befae5fde1897cf68c4d44a146db5ba642c814.tar
factory-boy-69befae5fde1897cf68c4d44a146db5ba642c814.tar.gz
Allow lazy evaluation of FuzzyChoice's iterators (Closes #184).
This allows the following idiom: ``user = factory.fuzzy.FuzzyChoice(User.objects.all())`` Previously, the ``User.objects.all()`` queryset would have been evaluated *at import time*; it is now evaluated with the first use of the ``FuzzyChoice``.
Diffstat (limited to 'docs')
-rw-r--r--docs/changelog.rst1
-rw-r--r--docs/fuzzy.rst7
2 files changed, 6 insertions, 2 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index ebe9930..13fdd68 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -10,6 +10,7 @@ ChangeLog
*New:*
- Add support for getting/setting :mod:`factory.fuzzy`'s random state (see :issue:`175`, :issue:`185`).
+ - Support lazy evaluation of iterables in :class:`factory.fuzzy.FuzzyChoice` (see :issue:`184`).
*Deprecation:*
diff --git a/docs/fuzzy.rst b/docs/fuzzy.rst
index 0658652..18978e4 100644
--- a/docs/fuzzy.rst
+++ b/docs/fuzzy.rst
@@ -62,8 +62,11 @@ FuzzyChoice
The :class:`FuzzyChoice` fuzzer yields random choices from the given
iterable.
- .. note:: The passed in :attr:`choices` will be converted into a list at
- declaration time.
+ .. note:: The passed in :attr:`choices` will be converted into a list upon
+ first use, not at declaration time.
+
+ This allows passing in, for instance, a Django queryset that will
+ only hit the database during the database, not at import time.
.. attribute:: choices