From: Vivien Maisonneuve Date: Sun, 13 Jul 2014 06:25:04 +0000 (+0200) Subject: Improve error messages in linexprs.py X-Git-Tag: 1.0~113 X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/commitdiff_plain/b046bdcc9044a88743a98bb06951f917edafae59?hp=2bad3743bd25bbcfe12db50e2b18ab8d070f2354 Improve error messages in linexprs.py --- diff --git a/pypol/linexprs.py b/pypol/linexprs.py index e73449e..229e8d9 100644 --- a/pypol/linexprs.py +++ b/pypol/linexprs.py @@ -44,11 +44,11 @@ class Expression: if not isinstance(symbol, Symbol): raise TypeError('symbols must be Symbol instances') if not isinstance(coefficient, numbers.Rational): - raise TypeError('coefficients must be Rational instances') + raise TypeError('coefficients must be rational numbers') coefficients = [(symbol, Fraction(coefficient)) for symbol, coefficient in coefficients if coefficient != 0] if not isinstance(constant, numbers.Rational): - raise TypeError('constant must be a Rational instance') + raise TypeError('constant must be a rational number') constant = Fraction(constant) if len(coefficients) == 0: return Rational(constant)