raise exception if fraction can't be build

This commit is contained in:
Lafrite 2015-04-27 19:24:20 +02:00
parent fcee4a8942
commit 9dd42d2151
1 changed files with 2 additions and 0 deletions

View File

@ -24,6 +24,8 @@ class Fraction(Explicable):
"""
super(Fraction, self).__init__()
self._num = num
if denom == 0:
raise ZeroDivisionError("Can't create Fraction: division by zero")
self._denom = denom
self.isNumber = 1