mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-29894: Deprecate returning an instance of complex subclass from __complex__. (#798)
In a future versions of Python this can be an error.
This commit is contained in:
parent
af7b9ec5c8
commit
671079ef60
4 changed files with 28 additions and 13 deletions
|
|
@ -408,7 +408,8 @@ class Float_TestCase(unittest.TestCase):
|
|||
self.assertEqual(getargs_D(ComplexSubclass(7.5+0.25j)), 7.5+0.25j)
|
||||
self.assertEqual(getargs_D(ComplexSubclass2(7.5+0.25j)), 7.5+0.25j)
|
||||
self.assertRaises(TypeError, getargs_D, BadComplex())
|
||||
self.assertEqual(getargs_D(BadComplex2()), 4.25+0.5j)
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
self.assertEqual(getargs_D(BadComplex2()), 4.25+0.5j)
|
||||
self.assertEqual(getargs_D(BadComplex3(7.5+0.25j)), 7.5+0.25j)
|
||||
|
||||
for x in (DBL_MIN, -DBL_MIN, DBL_MAX, -DBL_MAX, INF, -INF):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue