mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
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>
15 lines
367 B
Python
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__) |