diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-24 21:28:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-24 21:28:43 +0200 |
commit | 671079ef6063fe227460a6c3114625fb6282bbd0 (patch) | |
tree | 1b43f7ca1513741277932d064bcd9367dff88443 /Lib/test/test_complex.py | |
parent | af7b9ec5c855366feef4c67dc492d64b3baf84ca (diff) | |
download | cpython-git-671079ef6063fe227460a6c3114625fb6282bbd0.tar.gz |
bpo-29894: Deprecate returning an instance of complex subclass from __complex__. (#798)
In a future versions of Python this can be an error.
Diffstat (limited to 'Lib/test/test_complex.py')
-rw-r--r-- | Lib/test/test_complex.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index cee49343e2..2d883c5348 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -383,8 +383,9 @@ class ComplexTest(unittest.TestCase): def __complex__(self): return None - self.assertAlmostEqual(complex(complex0(1j)), 42j) - self.assertAlmostEqual(complex(complex1(1j)), 2j) + self.assertEqual(complex(complex0(1j)), 42j) + with self.assertWarns(DeprecationWarning): + self.assertEqual(complex(complex1(1j)), 2j) self.assertRaises(TypeError, complex, complex2(1j)) @support.requires_IEEE_754 |