circuitpython/tests/micropython/const_error.py
Scott Shawcroft b057fb8a4b
codeformat
2021-04-19 22:22:44 -07:00

18 lines
323 B
Python

# 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)")