Files
RustPython/extra_tests/snippets/complex.py
Snowapril 2aa58cc551 implement complex.__complex__
add `complex.__complex__` which will be added in cpython 3.11 for typing
module.

documents:
* https://docs.python.org/3.11/whatsnew/3.11.html#other-cpython-implementation-changes
* https://bugs.python.org/issue24234

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-08-29 11:33:56 +09:00

15 lines
367 B
Python

import testutils
# __complex__
def test__complex__():
z = 3 + 4j
assert z.__complex__() == z
assert type(z.__complex__()) == complex
class complex_subclass(complex):
pass
z = complex_subclass(3 + 4j)
assert z.__complex__() == 3 + 4j
assert type(z.__complex__()) == complex
testutils.skip_if_unsupported(3,11,test__complex__)