You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
321 B
16 lines
321 B
4 years ago
|
# 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)")
|