summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/re_error.py
blob: f61d0913289e1e0fb10d0f77597381693ca5722d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# test errors in regex

try:
    import re
except ImportError:
    print("SKIP")
    raise SystemExit


def test_re(r):
    try:
        re.compile(r)
        print("OK")
    except:  # uPy and CPy use different errors, so just ignore the type
        print("Error")


test_re(r"?")
test_re(r"*")
test_re(r"+")
test_re(r")")
test_re(r"[")
test_re(r"([")
test_re(r"([)")
test_re(r"[a\]")