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.
This commit is contained in:
Damien George
2016-01-04 13:13:39 +00:00
parent 824f83fd20
commit d4df8f4925
2 changed files with 5 additions and 4 deletions

View File

@@ -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"))