summaryrefslogtreecommitdiff
path: root/tests/micropython/const.py
AgeCommit message (Collapse)Author
2021-11-17tests/micropython/const.py: Add comment about required config for test.jc_.kim
Expected result of const.py will be matched only when MICROPY_COMP_CONST is enabled. For easy understanding, added description at the first of the test code.
2020-03-30tests: Format all Python code with black, except tests in basics subdir.David Lechner
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
2016-09-27py/modmicropython: Add micropython.const, alias for identity function.Damien George
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-06-06py/parse: Treat constants that start with underscore as private.Damien George
Assignments of the form "_id = const(value)" are treated as private (following a similar CPython convention) and code is no longer emitted for the assignment to a global variable. See issue #2111.
2014-05-08py, compiler: Add basic support for A=const(123).Damien George
You can now do: X = const(123) Y = const(456 + X) and the compiler will replace X and Y with their values. See discussion in issue #266 and issue #573.