Skip to content

Commit

Permalink
tests: Add some tests for printing floats to improve coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgeorge committed May 28, 2015
1 parent 79474c6 commit 9ede4dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/float/string_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
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)
5 changes: 5 additions & 0 deletions tests/float/string_format_modulo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@
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

0 comments on commit 9ede4dc

Please sign in to comment.