summaryrefslogtreecommitdiff
path: root/docs/fuzzy.rst
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/fuzzy.rst
parent8639d0f70b03acd0cd76f1c81207461e185f8615 (diff)
downloadfactory-boy-39383fea8bd5bd58b063d9c9fbb44301e781fd80.tar
factory-boy-39383fea8bd5bd58b063d9c9fbb44301e781fd80.tar.gz
fuzzy: Add FuzzyFloat (Closes #124).
As suggested by @savingschampion
Diffstat (limited to 'docs/fuzzy.rst')
-rw-r--r--docs/fuzzy.rst30
1 files changed, 28 insertions, 2 deletions
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
---------