summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2014-01-22 22:47:11 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2014-01-22 22:47:43 +0100
commit39383fea8bd5bd58b063d9c9fbb44301e781fd80 (patch)
tree82a42004c0ef1ad0f1e132399d426354b3ea080c /docs
parent8639d0f70b03acd0cd76f1c81207461e185f8615 (diff)
downloadfactory-boy-39383fea8bd5bd58b063d9c9fbb44301e781fd80.tar
factory-boy-39383fea8bd5bd58b063d9c9fbb44301e781fd80.tar.gz
fuzzy: Add FuzzyFloat (Closes #124).
As suggested by @savingschampion
Diffstat (limited to 'docs')
-rw-r--r--docs/changelog.rst1
-rw-r--r--docs/fuzzy.rst30
2 files changed, 29 insertions, 2 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 57b29c4..aba1d76 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -11,6 +11,7 @@ ChangeLog
- Add support for :attr:`factory.fuzzy.FuzzyInteger.step`, thanks to `ilya-pirogov <https://github.com/ilya-pirogov>`_ (:issue:`120`)
- Add :meth:`~factory.django.mute_signals` decorator to temporarily disable some signals, thanks to `ilya-pirogov <https://github.com>`_ (:issue:`122`)
+ - Add :class:`~factory.fuzzy.FuzzyFloat` (:issue:`124`)
.. _v2.3.1:
diff --git a/docs/fuzzy.rst b/docs/fuzzy.rst
index 2fe60b8..1480419 100644
--- a/docs/fuzzy.rst
+++ b/docs/fuzzy.rst
@@ -107,9 +107,9 @@ FuzzyInteger
FuzzyDecimal
------------
-.. class:: FuzzyDecimal(low[, high])
+.. class:: FuzzyDecimal(low[, high[, precision=2]])
- The :class:`FuzzyDecimal` fuzzer generates random integers within a given
+ The :class:`FuzzyDecimal` fuzzer generates random :class:`decimals <decimal.Decimal>` within a given
inclusive range.
The :attr:`low` bound may be omitted, in which case it defaults to 0:
@@ -140,6 +140,32 @@ FuzzyDecimal
int, the number of digits to generate after the dot. The default is 2 digits.
+FuzzyFloat
+----------
+
+.. class:: FuzzyFloat(low[, high])
+
+ The :class:`FuzzyFloat` fuzzer provides random :class:`float` objects within a given inclusive range.
+
+ .. code-block:: pycon
+
+ >>> FuzzyFloat(0.5, 42.7)
+ >>> fi.low, fi.high
+ 0.5, 42.7
+
+ >>> fi = FuzzyFloat(42.7)
+ >>> fi.low, fi.high
+ 0.0, 42.7
+
+
+ .. attribute:: low
+
+ decimal, the inclusive lower bound of generated floats
+
+ .. attribute:: high
+
+ decimal, the inclusive higher bound of generated floats
+
FuzzyDate
---------