please
please copied to clipboard
f-string formatting: braces not correctly escaped
With python f-strings, you state literal braces by doubling them:
print(f"{{word}}")
produces:
{word}
Please correctly does not attempt to interpret word as a variable, however it instead produces:
{{word}}
Here is the claim stated as a please test:
sh_cmd(
name="f_string-braces_escape.sh",
shell="/bin/bash",
cmd=[
f'F_STRING="{{word}}"',
'RAW_STRING="{word}"',
'[ "\\\$F_STRING" = "\\\$RAW_STRING" ]',
],
)
sh_test(
name="f_string-braces_escape",
src=":f_string-braces_escape.sh",
)