Commit 1cc55443 authored by Jeffrey Yasskin's avatar Jeffrey Yasskin

Extend unittest's fail*AlmostEqual methods to work on complex numbers.

parent d3f6c9d1
......@@ -339,7 +339,7 @@ class TestCase:
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 @@ class TestCase:
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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment