diff options
Diffstat (limited to 'factory/fuzzy.py')
-rw-r--r-- | factory/fuzzy.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/factory/fuzzy.py b/factory/fuzzy.py index 7fa0908..6c7a866 100644 --- a/factory/fuzzy.py +++ b/factory/fuzzy.py @@ -25,7 +25,7 @@ from __future__ import unicode_literals -from decimal import Decimal +import decimal import random import string import datetime @@ -136,7 +136,8 @@ class FuzzyDecimal(BaseFuzzyAttribute): super(FuzzyDecimal, self).__init__(**kwargs) def fuzz(self): - return Decimal(random.uniform(self.low, self.high)).quantize(Decimal(10) ** -self.precision) + base = decimal.Decimal(random.uniform(self.low, self.high)) + return base.quantize(decimal.Decimal(10) ** -self.precision) class FuzzyDate(BaseFuzzyAttribute): |