From: Nick Coghlan Date: Fri, 27 Jul 2007 10:36:30 +0000 (+0000) Subject: Make test_math error messages more meaningful for small discrepancies in results X-Git-Tag: v2.6a1~1539 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ec2ce9bbaeb9d21fe0390fea7dca8e04be526a23;p=thirdparty%2FPython%2Fcpython.git Make test_math error messages more meaningful for small discrepancies in results --- diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 699c621bcc80..d86298d01bd8 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -12,7 +12,11 @@ class MathTests(unittest.TestCase): def ftest(self, name, value, expected): if abs(value-expected) > eps: - self.fail('%s returned %f, expected %f'%\ + # Use %r instead of %f so the error message + # displays full precision. Otherwise discrepancies + # in the last few bits will lead to very confusing + # error messages + self.fail('%s returned %r, expected %r' % (name, value, expected)) def testConstants(self):