summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/string_fstring_invalid.py
blob: 6fce323c5bce4c3d9dd8dd2cea327727f92dc87b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# PEP-0498 specifies that '\\' and '#' must be disallowed explicitly, whereas
# MicroPython relies on the syntax error as a result of the substitution.

print(f"\\")
print(f"#")
try:
    eval("f'{\}'")
except SyntaxError:
    print("SyntaxError")
try:
    eval("f'{#}'")
except SyntaxError:
    print("SyntaxError")