summaryrefslogtreecommitdiff
path: root/tests/float/complex1.py
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2025-05-28 20:49:29 +0200
committerDamien George <damien@micropython.org>2025-06-10 15:41:24 +1000
commit2ce63b142068fc04aae701ae78af683736dc179c (patch)
treebf865a06cdbe96b9a38d3e7fe8b50c52eeec2677 /tests/float/complex1.py
parent0a98f3a91130d127c937d6865ead24b6693182eb (diff)
py/parsenum: Fix parsing complex literals with negative real part.
If a complex literal had a negative real part and a positive imaginary part, it was not parsed properly because the imaginary part also came out negative. Includes a test of complex parsing, which fails without this fix. Co-authored-by: ComplexSymbol <141301057+ComplexSymbol@users.noreply.github.com> Signed-off-by: Jeff Epler <jepler@gmail.com>
Diffstat (limited to 'tests/float/complex1.py')
-rw-r--r--tests/float/complex1.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/float/complex1.py b/tests/float/complex1.py
index f4107a139..0a1d98b9a 100644
--- a/tests/float/complex1.py
+++ b/tests/float/complex1.py
@@ -12,9 +12,11 @@ print(complex("1.2j"))
print(complex("1+j"))
print(complex("1+2j"))
print(complex("-1-2j"))
+print(complex("-1+2j"))
print(complex("+1-2j"))
print(complex(" -1-2j "))
print(complex(" +1-2j "))
+print(complex(" -1+2j "))
print(complex("nanj"))
print(complex("nan-infj"))
print(complex(1, 2))