diff options
author | Damien George <damien@micropython.org> | 2020-06-16 21:42:52 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-06-16 22:06:47 +1000 |
commit | a3c89cf907a3c2b7235ea86e9a229335212b9020 (patch) | |
tree | 4a2a3acb82af141fd0bad96279a8345a9d92ac14 /tests/cpydiff/syntax_assign_expr.py | |
parent | e0fe8ea644b54406ca82cefdc73c98cc2e9cbe9f (diff) |
tests/cpydiff: Add CPy diff test for assignment expression behaviour.
Diffstat (limited to 'tests/cpydiff/syntax_assign_expr.py')
-rw-r--r-- | tests/cpydiff/syntax_assign_expr.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/cpydiff/syntax_assign_expr.py b/tests/cpydiff/syntax_assign_expr.py new file mode 100644 index 000000000..d4ed063b3 --- /dev/null +++ b/tests/cpydiff/syntax_assign_expr.py @@ -0,0 +1,7 @@ +""" +categories: Syntax,Operators +description: MicroPython allows using := to assign to the variable of a comprehension, CPython raises a SyntaxError. +cause: MicroPython is optimised for code size and doesn't check this case. +workaround: Do not rely on this behaviour if writing CPython compatible code. +""" +print([i := -1 for i in range(4)]) |