summaryrefslogtreecommitdiff
path: root/docs/fuzzy.rst
diff options
context:
space:
mode:
authorOmer <omer@stokeet.com>2013-09-30 12:37:15 +0300
committerRaphaƫl Barrois <raphael.barrois@polytechnique.org>2013-10-29 00:25:32 +0100
commit132eca8fa36bc7360a3b2270da0c8833378bc718 (patch)
tree366eff75d3c2d12c67d96aeb56da61d8d3bc746a /docs/fuzzy.rst
parentdc482f67c83be2b2607e2e9c4b259c03a59d9532 (diff)
downloadfactory-boy-132eca8fa36bc7360a3b2270da0c8833378bc718.tar
factory-boy-132eca8fa36bc7360a3b2270da0c8833378bc718.tar.gz
Added a Fuzzy Decimal attribute.
Diffstat (limited to 'docs/fuzzy.rst')
-rw-r--r--docs/fuzzy.rst35
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/fuzzy.rst b/docs/fuzzy.rst
index 582a654..1843920 100644
--- a/docs/fuzzy.rst
+++ b/docs/fuzzy.rst
@@ -97,6 +97,41 @@ FuzzyInteger
.. attribute:: high
int, the inclusive higher bound of generated integers
+
+FuzzyDecimal
+------------
+
+.. class:: FuzzyDecimal(low[, high])
+
+ The :class:`FuzzyDecimal` fuzzer generates random integers within a given
+ inclusive range.
+
+ The :attr:`low` bound may be omitted, in which case it defaults to 0:
+
+ .. code-block:: pycon
+
+ >>> FuzzyDecimal(0.5, 42.7)
+ >>> fi.low, fi.high
+ 0.5, 42.7
+
+ >>> fi = FuzzyDecimal(42.7)
+ >>> fi.low, fi.high
+ 0.0, 42.7
+
+ >>> fi = FuzzyDecimal(0.5, 42.7, 3)
+ >>> fi.low, fi.high, fi.precision
+ 0.5, 42.7, 3
+
+ .. attribute:: low
+
+ decimal, the inclusive lower bound of generated decimals
+
+ .. attribute:: high
+
+ decimal, the inclusive higher bound of generated decimals
+
+ .. attribute:: precision
+ int, the number of digits to generate after the dot. The default is 2 digits.
FuzzyDate