tests: Add boolean-as-integer formatting tests for fixed regression.
As suggested by @dpgeorge in #5538.
This commit is contained in:
parent
35e664d779
commit
cb4472df42
@ -63,6 +63,12 @@ test("{:>20}", "foo")
|
||||
test("{:^20}", "foo")
|
||||
test("{:<20}", "foo")
|
||||
|
||||
# formatting bool as int
|
||||
test('{:d}', False)
|
||||
test('{:20}', False)
|
||||
test('{:d}', True)
|
||||
test('{:20}', True)
|
||||
|
||||
# nested format specifiers
|
||||
print("{:{}}".format(123, '#>10'))
|
||||
print("{:{}{}{}}".format(123, '#', '>', '10'))
|
||||
|
@ -40,6 +40,9 @@ print("%c" % 'a')
|
||||
print("%10s" % 'abc')
|
||||
print("%-10s" % 'abc')
|
||||
|
||||
print('%c' % False)
|
||||
print('%c' % True)
|
||||
|
||||
# Should be able to print dicts; in this case they aren't used
|
||||
# to lookup keywords in formats like %(foo)s
|
||||
print('%s' % {})
|
||||
|
@ -24,6 +24,9 @@ test("{:06e}", float("inf"))
|
||||
test("{:06e}", float("-inf"))
|
||||
test("{:06e}", float("nan"))
|
||||
|
||||
test('{:f}', False)
|
||||
test('{:f}', True)
|
||||
|
||||
# The following fails right now
|
||||
#test("{:10.1}", 0.0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user