mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-24234: implement complex.__complex__ (GH-27887)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
This commit is contained in:
parent
eec340ea3a
commit
6082bb5add
6 changed files with 57 additions and 3 deletions
|
@ -1533,11 +1533,11 @@ class ProtocolTests(BaseTestCase):
|
|||
|
||||
def test_supports_complex(self):
|
||||
|
||||
# Note: complex itself doesn't have __complex__.
|
||||
class C:
|
||||
def __complex__(self):
|
||||
return 0j
|
||||
|
||||
self.assertIsSubclass(complex, typing.SupportsComplex)
|
||||
self.assertIsSubclass(C, typing.SupportsComplex)
|
||||
self.assertNotIsSubclass(str, typing.SupportsComplex)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue