diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-06-04 20:41:44 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-06-04 20:41:44 (GMT) |
commit | 80af6da7489c3b28e0a46c73849da34273972e3b (patch) | |
tree | 5571b9dfffaacc77b06124dafe3441f9c4d2cebd /Lib | |
parent | d5bb9215c960da14e138adc88c80daa54e6601c4 (diff) | |
download | cpython-80af6da7489c3b28e0a46c73849da34273972e3b.zip cpython-80af6da7489c3b28e0a46c73849da34273972e3b.tar.gz cpython-80af6da7489c3b28e0a46c73849da34273972e3b.tar.bz2 |
Fixed complex.__getnewargs__() to not emit another complex object.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_complex.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index 5f623a1..9a33101 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -373,6 +373,14 @@ class ComplexTest(unittest.TestCase): except (OSError, IOError): pass + def test_getnewargs(self): + self.assertEqual((1+2j).__getnewargs__(), (1.0, 2.0)) + self.assertEqual((1-2j).__getnewargs__(), (1.0, -2.0)) + self.assertEqual((2j).__getnewargs__(), (0.0, 2.0)) + self.assertEqual((-0j).__getnewargs__(), (0.0, -0.0)) + self.assertEqual(complex(0, INF).__getnewargs__(), (0.0, INF)) + self.assertEqual(complex(INF, 0).__getnewargs__(), (INF, 0.0)) + if float.__getformat__("double").startswith("IEEE"): def test_plus_minus_0j(self): # test that -0j and 0j literals are not identified |