micropython/tests/cpydiff
Jared Hancock b3cd41dd4b py/lexer: Allow conversion specifiers in f-strings (e.g. !r).
PEP-498 allows for conversion specifiers like !r and !s to convert the
expression declared in braces to be passed through repr() and str()
respectively.

This updates the logic that detects the end of the expression to also stop
when it sees "![rs]" that is either at the end of the f-string or before
the ":" indicating the start of the format specifier. The "![rs]" is now
retained in the format string, whereas previously it stayed on the end
of the expression leading to a syntax error.

Previously: `f"{x!y:z}"` --> `"{:z}".format(x!y)`
Now: `f"{x!y:z}"` --> `"{!y:z}".format(x)`

Note that "!a" is not supported by `str.format` as MicroPython has no
`ascii()`, but now this will raise the correct error.

Updated cpydiff and added tests.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-14 19:11:04 +10:00
..
modules
modules2/subpkg
modules3
builtin_next_arg2.py
core_class_delnotimpl.py
core_class_mro.py
core_class_supermultiple.py
core_class_superproperty.py
core_fstring_concat.py tests/cpydiff: Clarify f-string diffs regarding concatenation. 2021-11-25 22:09:59 +11:00
core_fstring_parser.py py/lexer: Support nested [] and {} characters within f-string params. 2021-11-25 21:50:58 +11:00
core_fstring_raw.py py: Implement partial PEP-498 (f-string) support. 2021-08-14 16:58:40 +10:00
core_fstring_repr.py py/lexer: Allow conversion specifiers in f-strings (e.g. !r). 2023-06-14 19:11:04 +10:00
core_function_argcount.py
core_function_moduleattr.py tests/cpydiff: Add test and workaround for function.__module__ attr. 2021-05-16 11:06:46 +10:00
core_function_userattr.py
core_generator_noexit.py
core_import_all.py
core_import_path.py all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
core_import_split_ns_pkgs.py all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
core_locals.py
core_locals_eval.py
module_array_comparison.py
module_array_constructor.py tests/cpydiff: Add test for array constructor with overflowing value. 2021-06-13 10:30:14 +10:00
modules_array_containment.py
modules_array_deletion.py
modules_array_subscrstep.py
modules_deque.py
modules_json_nonserializable.py
modules_os_environ.py
modules_os_getenv.py
modules_random_getrandbits.py extmod/modurandom: Add error message when getrandbits has bad value. 2021-05-30 16:41:30 +10:00
modules_random_randint.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
modules_struct_fewargs.py
modules_struct_manyargs.py
modules_struct_whitespace_in_format.py tests/cpydiff/modules_struct_whitespace_in_format: Run black. 2021-07-06 18:19:55 -05:00
modules_sys_stdassign.py
syntax_arg_unpacking.py py/runtime: Allow multiple *args in a function call. 2022-03-31 16:59:30 +11:00
syntax_assign_expr.py
syntax_spaces.py
syntax_unicode_nameesc.py
types_bytearray_sliceassign.py
types_bytes_format.py
types_bytes_keywords.py
types_bytes_subscrstep.py
types_dict_keys_set.py
types_exception_attrs.py
types_exception_chaining.py
types_exception_instancevar.py
types_exception_loops.py
types_exception_subclassinit.py
types_float_implicit_conversion.py tests/cpydiff: Fix formatting of code snippet to use double quotes. 2022-07-29 12:23:05 +10:00
types_float_rounding.py
types_int_bit_length.py extmod/modurandom: Add error message when getrandbits has bad value. 2021-05-30 16:41:30 +10:00
types_int_subclassconv.py
types_list_delete_subscrstep.py
types_list_store_noniter.py
types_list_store_subscrstep.py
types_str_endswith.py
types_str_formatsubscr.py
types_str_keywords.py
types_str_ljust_rjust.py
types_str_rsplitnone.py
types_str_subscrstep.py
types_tuple_subscrstep.py