tests: Add some tests for printing floats to improve coverage.
This commit is contained in:
parent
79474c6b16
commit
9ede4dcfbb
|
@ -122,6 +122,9 @@ if full_tests:
|
|||
test_fmt('', fill, alignment, sign, '', width, prec, type, num)
|
||||
for num in pct_nums2:
|
||||
test_fmt('', fill, alignment, sign, '', width, '', type, num)
|
||||
else:
|
||||
for num in pct_nums1:
|
||||
test_fmt('', '', '', '', '', '', '1', '%', num)
|
||||
|
||||
# We don't currently test a type of '' with floats (see the detailed comment
|
||||
# in objstr.c)
|
||||
|
|
|
@ -21,3 +21,8 @@ print("%G" % 1.23456)
|
|||
print("%06e" % float("inf"))
|
||||
print("%06e" % float("-inf"))
|
||||
print("%06e" % float("nan"))
|
||||
|
||||
print("%02.3d" % 123) # prec > width
|
||||
print("%+f %+f" % (1.23, -1.23)) # float sign
|
||||
print("% f % f" % (1.23, -1.23)) # float space sign
|
||||
print("%0f" % -1.23) # negative number with 0 padding
|
||||
|
|
Loading…
Reference in New Issue