if isinstance(other, CentCount):
if self.currency == other.currency:
return CentCount(
- centcount=self.centcount + other.centcount, currency=self.currency
+ centcount=self.centcount + other.centcount,
+ currency=self.currency,
)
else:
raise TypeError('Incompatible currencies in add expression')
if isinstance(other, CentCount):
if self.currency == other.currency:
return CentCount(
- centcount=self.centcount - other.centcount, currency=self.currency
+ centcount=self.centcount - other.centcount,
+ currency=self.currency,
)
else:
raise TypeError('Incompatible currencies in add expression')
raise TypeError('can not multiply monetary quantities')
else:
return CentCount(
- centcount=int(self.centcount * float(other)), currency=self.currency
+ centcount=int(self.centcount * float(other)),
+ currency=self.currency,
)
def __truediv__(self, other):
if isinstance(other, CentCount):
if self.currency == other.currency:
return CentCount(
- centcount=other.centcount - self.centcount, currency=self.currency
+ centcount=other.centcount - self.centcount,
+ currency=self.currency,
)
else:
raise TypeError('Incompatible currencies in sub expression')
raise TypeError('In strict_mode only two moneys can be added')
else:
return CentCount(
- centcount=int(other) - self.centcount, currency=self.currency
+ centcount=int(other) - self.centcount,
+ currency=self.currency,
)
__rmul__ = __mul__