tests: Add boolean-as-integer formatting tests for fixed regression.

As suggested by @dpgeorge in #5538.
pull/5569/head
Yonatan Goldschmidt 2020-01-22 20:53:54 +01:00 zatwierdzone przez Damien George
rodzic 35e664d779
commit cb4472df42
3 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

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

Wyświetl plik

@ -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' % {})

Wyświetl plik

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