projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a doctest to type_utils.py.
[python_utils.git]
/
type
/
money.py
diff --git
a/type/money.py
b/type/money.py
index d7e6ffa2197c629949ecae30c855df5870cc3a3a..39557aacdf79dc31ca6e48d27f367305325e80b8 100644
(file)
--- a/
type/money.py
+++ b/
type/money.py
@@
-60,7
+60,8
@@
class Money(object):
raise TypeError('In strict_mode only two moneys can be added')
else:
return Money(
raise TypeError('In strict_mode only two moneys can be added')
else:
return Money(
- amount=self.amount + Decimal(float(other)), currency=self.currency
+ amount=self.amount + Decimal(float(other)),
+ currency=self.currency,
)
def __sub__(self, other):
)
def __sub__(self, other):
@@
-74,7
+75,8
@@
class Money(object):
raise TypeError('In strict_mode only two moneys can be added')
else:
return Money(
raise TypeError('In strict_mode only two moneys can be added')
else:
return Money(
- amount=self.amount - Decimal(float(other)), currency=self.currency
+ amount=self.amount - Decimal(float(other)),
+ currency=self.currency,
)
def __mul__(self, other):
)
def __mul__(self, other):
@@
-82,7
+84,8
@@
class Money(object):
raise TypeError('can not multiply monetary quantities')
else:
return Money(
raise TypeError('can not multiply monetary quantities')
else:
return Money(
- amount=self.amount * Decimal(float(other)), currency=self.currency
+ amount=self.amount * Decimal(float(other)),
+ currency=self.currency,
)
def __truediv__(self, other):
)
def __truediv__(self, other):
@@
-90,7
+93,8
@@
class Money(object):
raise TypeError('can not divide monetary quantities')
else:
return Money(
raise TypeError('can not divide monetary quantities')
else:
return Money(
- amount=self.amount / Decimal(float(other)), currency=self.currency
+ amount=self.amount / Decimal(float(other)),
+ currency=self.currency,
)
def __float__(self):
)
def __float__(self):
@@
-119,7
+123,8
@@
class Money(object):
raise TypeError('In strict_mode only two moneys can be added')
else:
return Money(
raise TypeError('In strict_mode only two moneys can be added')
else:
return Money(
- amount=Decimal(float(other)) - self.amount, currency=self.currency
+ amount=Decimal(float(other)) - self.amount,
+ currency=self.currency,
)
__rmul__ = __mul__
)
__rmul__ = __mul__