diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/changelog.rst | 1 | ||||
-rw-r--r-- | docs/fuzzy.rst | 30 |
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 --------- |