mirror of
https://github.com/micropython/micropython.git
synced 2026-03-11 19:30:28 +01:00
tests: Add full feature and coverage tests for PEP 750 template strings.
Includes corresponding .exp files because this feature is only available in Python 3.14+. Tests for `!a` conversion specifier and space after `!` are not included because they are not supported by MicroPython. Signed-off-by: Koudai Aono <koxudaxi@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
committed by
Damien George
parent
a989585147
commit
bdef10a92b
60
tests/basics/string_tstring_parser1.py.exp
Normal file
60
tests/basics/string_tstring_parser1.py.exp
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
=== Empty expression tests ===
|
||||
Empty expr SyntaxError: malformed f-string
|
||||
Whitespace expr SyntaxError: malformed f-string
|
||||
Whitespace expr: SyntaxError
|
||||
Unterminated expr: SyntaxError
|
||||
Whitespace + conversion: SyntaxError
|
||||
Long expression: OK
|
||||
Template.__str__ with large string: OK
|
||||
Basic t-string: OK, result=Template(strings=('', ''), interpolations=(Interpolation('a', 'x', None, ''),))
|
||||
Nested interpolations error: SyntaxError: invalid syntax
|
||||
Escaped braces result: Template(strings=('', ''), interpolations=(Interpolation(42, 'x', None, '5{literal}'),))
|
||||
|
||||
=== Expression parser tests ===
|
||||
Complex expr: OK
|
||||
|
||||
=== Lexer edge cases ===
|
||||
Lexer NULL case: Tested via heapalloc_fail_tstring.py
|
||||
|
||||
=== Parser allocation edge cases ===
|
||||
Deep nesting: OK
|
||||
Very long expression: OK
|
||||
|
||||
=== Additional parser regression tests ===
|
||||
Raw nested spec: "QUOTED"
|
||||
Escaped quote spec: "QUOTED"
|
||||
Escaped backslash spec: \n
|
||||
Nested quoted spec: \
|
||||
Literal brace error: SyntaxError: malformed f-string
|
||||
Unterminated field: malformed f-string
|
||||
|
||||
=== Complex expression stress test ===
|
||||
60 terms: PASS
|
||||
100 terms: PASS
|
||||
|
||||
=== Stack expansion test (copy_parse_node) ===
|
||||
Stack expansion: OK
|
||||
|
||||
=== Format spec with triple-quoted strings ===
|
||||
Triple-quote in format spec: OK
|
||||
Triple single-quote in format spec: OK
|
||||
|
||||
=== Format spec parse error (exception handler) ===
|
||||
Parse error handler: OK
|
||||
Parse error handler 2: OK
|
||||
|
||||
=== Large integer in t-string ===
|
||||
Large integer: OK
|
||||
|
||||
=== Bytes in expression ===
|
||||
Bytes in expression: OK
|
||||
|
||||
=== Boolean constants ===
|
||||
Boolean constants: OK
|
||||
|
||||
=== None constant ===
|
||||
None constant: OK
|
||||
|
||||
=== Deep nesting for rule stack expansion ===
|
||||
Deep nesting (depth=80): OK
|
||||
Reference in New Issue
Block a user