Commit 8c4ba575 authored by Damien George's avatar Damien George

tests/basics: Split f-string debug printing to separate file with .exp.

This feature {x=} was introduced in Python 3.8 so needs a separate .exp
file to run on earlier Python versions.

See https://bugs.python.org/issue36817Signed-off-by: default avatarDamien George <damien@micropython.org>
parent 145fedef
...@@ -12,17 +12,11 @@ print(f"""no interpolation""") ...@@ -12,17 +12,11 @@ print(f"""no interpolation""")
x, y = 1, 2 x, y = 1, 2
print(f'{x}') print(f'{x}')
print(f'{x:08x}') print(f'{x:08x}')
print(f'{x=}')
print(f'{x=:08x}')
print(f'a {x} b {y} c') print(f'a {x} b {y} c')
print(f'a {x:08x} b {y} c') print(f'a {x:08x} b {y} c')
print(f'a {x=} b {y} c')
print(f'a {x=:08x} b {y} c')
print(f'a {"hello"} b') print(f'a {"hello"} b')
print(f'a {f() + g("foo") + h()} b') print(f'a {f() + g("foo") + h()} b')
print(f'a {f() + g("foo") + h()=} b')
print(f'a {f() + g("foo") + h()=:08x} b')
def foo(a, b): def foo(a, b):
return f'{x}{y}{a}{b}' return f'{x}{y}{a}{b}'
......
# test f-string debug feature {x=}
def f():
return 4
def g(_):
return 5
def h():
return 6
x, y = 1, 2
print(f"{x=}")
print(f"{x=:08x}")
print(f"a {x=} b {y} c")
print(f"a {x=:08x} b {y} c")
print(f'a {f() + g("foo") + h()=} b')
print(f'a {f() + g("foo") + h()=:08x} b')
x=1
x=00000001
a x=1 b 2 c
a x=00000001 b 2 c
a f() + g("foo") + h()=15 b
a f() + g("foo") + h()=0000000f b
...@@ -101,6 +101,7 @@ exclude_tests = ( ...@@ -101,6 +101,7 @@ exclude_tests = (
"misc/sys_settrace_features.py", "misc/sys_settrace_features.py",
# don't have f-string # don't have f-string
"basics/string_fstring.py", "basics/string_fstring.py",
"basics/string_fstring_debug.py",
) )
output = [] output = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment