diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/string_format.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/basics/string_format.py b/tests/basics/string_format.py index 7fb53cb491..e07f0d9533 100644 --- a/tests/basics/string_format.py +++ b/tests/basics/string_format.py @@ -66,6 +66,14 @@ test("{:>20}", "foo") test("{:^20}", "foo") test("{:<20}", "foo") +# nested format specifiers +print("{:{}}".format(123, '#>10')) +print("{:{}{}{}}".format(123, '#', '>', '10')) +print("{0:{1}{2}}".format(123, '#>', '10')) +print("{text:{align}{width}}".format(text="foo", align="<", width=20)) +print("{text:{align}{width}}".format(text="foo", align="^", width=10)) +print("{text:{align}{width}}".format(text="foo", align=">", width=30)) + print("{foo}/foo".format(foo="bar")) print("{}".format(123, foo="bar")) print("{}-{foo}".format(123, foo="bar")) |