Skip to content

Commit ef567dc

Browse files
jeplerdpgeorge
authored andcommitted
tests/basics/string_fstring.py: Test fstring nested replacement fields.
This does not actually cover any additional lines, but it does cover new functionality not previously covered. Signed-off-by: Jeff Epler <[email protected]>
1 parent b78fac1 commit ef567dc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/basics/string_fstring.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,14 @@ def foo(a, b):
7979
# Raw f-strings.
8080
print(rf"\r\a\w {'f'} \s\t\r\i\n\g")
8181
print(fr"\r{x}")
82+
83+
# Format specifiers with nested replacement fields
84+
space = 5
85+
prec = 2
86+
print(f"{3.14:{space}.{prec}}")
87+
88+
space_prec = "5.2"
89+
print(f"{3.14:{space_prec}}")
90+
91+
radix = "x"
92+
print(f"{314:{radix}}")

0 commit comments

Comments
 (0)