Skip to content

Commit 55278dc

Browse files
committed
tests: Add test for modure when regex has errors.
1 parent 8dead2a commit 55278dc

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/extmod/ure_error.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# test errors in regex
2+
3+
try:
4+
import ure as re
5+
except:
6+
import re
7+
8+
def test_re(r):
9+
try:
10+
re.compile(r)
11+
print("OK")
12+
except: # uPy and CPy use different errors, so just ignore the type
13+
print("Error")
14+
15+
test_re(r'?')
16+
test_re(r'*')
17+
test_re(r'+')
18+
test_re(r')')
19+
test_re(r'[')
20+
test_re(r'([')
21+
test_re(r'([)')

0 commit comments

Comments
 (0)