Skip to content

Commit f256cfe

Browse files
committed
tests: Add some more tests for complex numbers and ure module.
1 parent fa1edff commit f256cfe

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

tests/extmod/ure1.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,9 @@
5656

5757
m = re.search("w.r", "hello world")
5858
print(m.group(0))
59+
60+
m = re.match('a+?', 'ab'); print(m.group(0))
61+
m = re.match('a*?', 'ab'); print(m.group(0))
62+
m = re.match('^ab$', 'ab'); print(m.group(0))
63+
m = re.match('a|b', 'b'); print(m.group(0))
64+
m = re.match('a|b|c', 'c'); print(m.group(0))

tests/float/complex1.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# unary ops
1414
print(bool(1j))
1515
print(+(1j))
16-
#print(-(1j)) uPy doesn't print correctly
16+
print(-(1 + 2j))
1717

1818
# binary ops
1919
print(1j + 2)
@@ -23,10 +23,10 @@
2323
print(1j * 2)
2424
print(1j * 2j)
2525
print(1j / 2)
26-
#print(1j / 2j) uPy doesn't print correctly
27-
#print(1j ** 2) uPy doesn't print correctly
28-
#print(1j ** 2j) uPy doesn't print correctly
26+
print(1j / (1 + 2j))
27+
ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag))
28+
ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag))
2929

3030
# builtin abs
3131
print(abs(1j))
32-
print(abs(1j + 2))
32+
print("%.5g" % abs(1j + 2))

0 commit comments

Comments
 (0)