Author: jeffrey.yasskin
Date: Thu Sep  6 20:55:17 2007
New Revision: 58017

Modified:
   python/branches/py3k/Lib/unittest.py
Log:
Extend unittest's fail*AlmostEqual methods to work on complex numbers.


Modified: python/branches/py3k/Lib/unittest.py
==============================================================================
--- python/branches/py3k/Lib/unittest.py        (original)
+++ python/branches/py3k/Lib/unittest.py        Thu Sep  6 20:55:17 2007
@@ -339,7 +339,7 @@
            Note that decimal places (from zero) are usually not the same
            as significant digits (measured from the most signficant digit).
         """
-        if round(second-first, places) != 0:
+        if round(abs(second-first), places) != 0:
             raise self.failureException(msg or '%r != %r within %r places'
                                                % (first, second, places))
 
@@ -351,7 +351,7 @@
            Note that decimal places (from zero) are usually not the same
            as significant digits (measured from the most signficant digit).
         """
-        if round(second-first, places) == 0:
+        if round(abs(second-first), places) == 0:
             raise self.failureException(msg or '%r == %r within %r places'
                                                % (first, second, places))
 
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to