Files
micropython/tests/basics/string_tstring_basic1.py.exp
Koudai Aono bdef10a92b 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>
2026-03-09 23:47:33 +11:00

42 lines
1.5 KiB
Plaintext

=== Parser error tests ===
Empty expr: SyntaxError - malformed f-string
Whitespace: Template(strings=('', ''), interpolations=(Interpolation(42, ' 42', None, ''),))
=== Error cases ===
Invalid syntax: SyntaxError
Long expr: Error
Mixed concat: SyntaxError
bt prefix: SyntaxError
=== Escape sequence coverage tests ===
Template(strings=('\\8',), interpolations=())
Template(strings=('\\9',), interpolations=())
Template(strings=('\\z',), interpolations=())
Template(strings=('\\k',), interpolations=())
Invalid \x escape: SyntaxError
Invalid \u escape: SyntaxError
Invalid \U escape: SyntaxError
Template(strings=('\x00\x01\xff',), interpolations=())
Template(strings=('A',), interpolations=())
Template(strings=('\u03b1',), interpolations=())
Template(strings=('\u2764',), interpolations=())
Template(strings=('A',), interpolations=())
Template(strings=('\U0001f600',), interpolations=())
Template(strings=('ABC',), interpolations=())
Unicode: Template(strings=('Unicode test:\nEmoji: ', '\nSpecial: ', ''), interpolations=(Interpolation('\U0001f40d', "'\\U0001f40d'", None, ''), Interpolation('\u03b1 \u03b2 \u03b3', "'\\u03b1 \\u03b2 \\u03b3'", None, '')))
=== Trailing whitespace preservation (PEP 750) ===
Expression with trailing spaces: |x|
Expression with both spaces: | x|
Expression with leading spaces: | x|
Trailing whitespace: PASS
=== Error message tests ===
Lone }} rejected (correct)
Unterminated {{ rejected (correct)
=== Triple quote empty interpolation ===
Empty interpolation error: SyntaxError: malformed f-string
Incompatible tests completed!