Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/micropython/const_error.py

16 lines
321 B
Python
Raw Normal View History

tests: Add tests for SyntaxError, TypeError, and other missing things. This is intended to improve coverage of the test suite.
2015-03-25 23:10:09 +00:00
# make sure syntax error works correctly for bad const definition
tests: Add test for micropython const feature when it has a SyntaxError.
2015-03-01 12:06:24 +00:00
py/modmicropython: Add micropython.const, alias for identity function. Having a micropython.const identity function, and writing "from micropython import const" at the start of scripts that use the const feature, allows to write scripts which are compatible with CPython, and with uPy builds that don't include const optimisation. This patch adds such a function and updates the tests to do the import.
2016-09-27 13:34:21 +10:00
from micropython import const
tests: Add tests for SyntaxError, TypeError, and other missing things. This is intended to improve coverage of the test suite.
2015-03-25 23:10:09 +00:00
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)")
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 93ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API