diff options
author | Damien George <damien.p.george@gmail.com> | 2016-01-04 13:13:39 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-01-04 13:13:39 +0000 |
commit | d4df8f4925ae6e4875b521f1c35571f0b51e405a (patch) | |
tree | 3303cde75697e895767bbd77f2865c10322364fc /tests/basics/string_format.py | |
parent | 824f83fd201bcbabc4b07d2beb3000bdf33381a8 (diff) | |
download | micropython-d4df8f4925ae6e4875b521f1c35571f0b51e405a.tar.gz micropython-d4df8f4925ae6e4875b521f1c35571f0b51e405a.zip |
py/objstr: In str.format, handle case of no format spec for string arg.
Handles, eg, "{:>20}".format("foo"), where there is no explicit spec for
the type of the argument.
Diffstat (limited to 'tests/basics/string_format.py')
-rw-r--r-- | tests/basics/string_format.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/basics/string_format.py b/tests/basics/string_format.py index d8724c9474..7fb53cb491 100644 --- a/tests/basics/string_format.py +++ b/tests/basics/string_format.py @@ -62,6 +62,10 @@ test("{:@<6d}", -123) test("{:@=6d}", -123) test("{:06d}", -123) +test("{:>20}", "foo") +test("{:^20}", "foo") +test("{:<20}", "foo") + print("{foo}/foo".format(foo="bar")) print("{}".format(123, foo="bar")) print("{}-{foo}".format(123, foo="bar")) |