Skip to content

Commit b14d129

Browse files
committed
tests/float/complex1.py: Fix CPython 3.14 deprecation.
This commit fixes a test exercising complex numbers creation, working around a deprecation introduced in CPython 3.14. Creating complex numbers using a complex number as the real part in the constructor is deprecated in CPython 3.14, but that construction method is still supported by MicroPython and covered by tests. To work around this, the specific constructor is extracted into its own test, providing an expected output file recorded using CPython 3.11. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent eae83df commit b14d129

4 files changed

Lines changed: 8 additions & 1 deletion

File tree

tests/float/complex1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
print(complex("nanj"))
2121
print(complex("nan-infj"))
2222
print(complex(1, 2))
23-
print(complex(1j, 2j))
2423

2524
# unary ops
2625
print(bool(1j))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# test basic complex number functionality
2+
3+
# CPython 3.14 marks this constructor as deprecated, but it is still currently
4+
# supported by MicroPython.
5+
6+
print(complex(1j, 2j))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(-2+1j)

tests/run-tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
10191019
if not has_complex:
10201020
skip_tests.add("float/complex1.py")
10211021
skip_tests.add("float/complex1_intbig.py")
1022+
skip_tests.add("float/complex1_micropython.py")
10221023
skip_tests.add("float/complex_reverse_op.py")
10231024
skip_tests.add("float/complex_special_methods.py")
10241025
skip_tests.add("float/int_big_float.py")

0 commit comments

Comments
 (0)