[Python-checkins] r56566 - python/trunk/Lib/test/test_math.py

nick.coghlan python-checkins at python.org
Fri Jul 27 12:36:30 CEST 2007


Author: nick.coghlan
Date: Fri Jul 27 12:36:30 2007
New Revision: 56566

Modified:
   python/trunk/Lib/test/test_math.py
Log:
Make test_math error messages more meaningful for small discrepancies in results

Modified: python/trunk/Lib/test/test_math.py
==============================================================================
--- python/trunk/Lib/test/test_math.py	(original)
+++ python/trunk/Lib/test/test_math.py	Fri Jul 27 12:36:30 2007
@@ -12,7 +12,11 @@
 
     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):


More information about the Python-checkins mailing list