Commit 9ede4dcf authored by Damien George's avatar Damien George
Browse files

tests: Add some tests for printing floats to improve coverage.

parent 79474c6b
...@@ -122,6 +122,9 @@ if full_tests: ...@@ -122,6 +122,9 @@ if full_tests:
test_fmt('', fill, alignment, sign, '', width, prec, type, num) test_fmt('', fill, alignment, sign, '', width, prec, type, num)
for num in pct_nums2: for num in pct_nums2:
test_fmt('', fill, alignment, sign, '', width, '', type, num) 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 # We don't currently test a type of '' with floats (see the detailed comment
# in objstr.c) # in objstr.c)
...@@ -21,3 +21,8 @@ print("%G" % 1.23456) ...@@ -21,3 +21,8 @@ print("%G" % 1.23456)
print("%06e" % float("inf")) print("%06e" % float("inf"))
print("%06e" % float("-inf")) print("%06e" % float("-inf"))
print("%06e" % float("nan")) 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment