diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-10-29 00:23:11 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-10-29 00:26:21 +0100 |
commit | 382e319a934d27e16b9d0ae8597923ab85976694 (patch) | |
tree | 550e295beb260e3ad6961d36a57f559e6135d7cc /factory | |
parent | 132eca8fa36bc7360a3b2270da0c8833378bc718 (diff) | |
download | factory-boy-382e319a934d27e16b9d0ae8597923ab85976694.tar factory-boy-382e319a934d27e16b9d0ae8597923ab85976694.tar.gz |
Style fixes for FuzzyDecimal (Closes #94).
Diffstat (limited to 'factory')
-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): |