From 9dd42d215163e5561168a200671dbe80c470b749 Mon Sep 17 00:00:00 2001 From: Lafrite Date: Mon, 27 Apr 2015 19:24:20 +0200 Subject: [PATCH] raise exception if fraction can't be build --- pymath/fraction.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pymath/fraction.py b/pymath/fraction.py index 9369c64..fe72c48 100644 --- a/pymath/fraction.py +++ b/pymath/fraction.py @@ -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