summaryrefslogtreecommitdiff
path: root/tests/micropython/const_error.py
blob: 311cfb4d5e09bb9be90407c4a8fe198e68f31085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# make sure syntax error works correctly for bad const definition

from micropython import const


def test_syntax(code):
    try:
        exec(code)
    except SyntaxError:
        print("SyntaxError")


# argument not a constant
test_syntax("a = const(x)")

# redefined constant
test_syntax("A = const(1); A = const(2)")