summaryrefslogtreecommitdiffstatshomepage
path: root/tests/misc/non_compliant_lexer.py
blob: e1c21f3d713c41df2bdc0b61efff5a0c81209fa0 (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
26
27
28
29
30
31
32
33
# lexer tests for things that are not implemented, or have non-compliant behaviour


def test(code):
    try:
        exec(code)
        print("no Error")
    except SyntaxError:
        print("SyntaxError")
    except NotImplementedError:
        print("NotImplementedError")


# uPy requires spaces between literal numbers and keywords, CPy doesn't
try:
    eval("1and 0")
except SyntaxError:
    print("SyntaxError")
try:
    eval("1or 0")
except SyntaxError:
    print("SyntaxError")
try:
    eval("1if 1else 0")
except SyntaxError:
    print("SyntaxError")
try:
    eval("1if 0else 0")
except SyntaxError:
    print("SyntaxError")

# unicode name escapes are not implemented
test('"\\N{LATIN SMALL LETTER A}"')