bpo-24234: implement complex.__complex__ (GH-27887)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
This commit is contained in:
Mark Dickinson 2021-08-23 09:15:49 +01:00 committed by GitHub
parent eec340ea3a
commit 6082bb5add
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 3 deletions

View file

@ -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)