diff options
author | Damien George <damien@micropython.org> | 2021-11-19 10:36:16 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-11-25 21:50:58 +1100 |
commit | 11ed94797d492cabdaf09396feb69a690e86f739 (patch) | |
tree | 91addc414188e2261fba36703de651752eb034b4 /tests/basics/string_fstring.py | |
parent | 196d26848a76043777e4e3ebb2455f26e6349dfc (diff) |
py/lexer: Support nested [] and {} characters within f-string params.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/basics/string_fstring.py')
-rw-r--r-- | tests/basics/string_fstring.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/basics/string_fstring.py b/tests/basics/string_fstring.py index 4f7225fca..7e8a97fd3 100644 --- a/tests/basics/string_fstring.py +++ b/tests/basics/string_fstring.py @@ -22,6 +22,13 @@ def foo(a, b): return f'{x}{y}{a}{b}' print(foo(7, 8)) +# ':' character within {...} that should not be interpreted as format specifiers. +print(f"a{[0,1,2][0:2]}") +print(f"a{[0,15,2][0:2][-1]:04x}") + +# Nested '{' and '}' characters. +print(f"a{ {0,1,2}}") + # PEP-0498 specifies that '\\' and '#' must be disallowed explicitly, whereas # MicroPython relies on the syntax error as a result of the substitution. |