Skip to content

Commit bb00948

Browse files
authored
Merge pull request #1 from nedbat/nedbat/add-test-to-1479
test: add another test of correct report formatting
2 parents 52c8ae8 + 9f2c978 commit bb00948

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_summary.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,29 @@ def foo():
538538
assert squeezed[4] == "not_covered.py 4 0 2 1 83.333%"
539539
assert squeezed[6] == "TOTAL 13 0 4 1 94.118%"
540540

541+
def test_report_precision_all_zero(self):
542+
self.make_file("not_covered.py", """
543+
def not_covered(n):
544+
if n:
545+
print("n")
546+
""")
547+
self.make_file("empty.py", "")
548+
cov = coverage.Coverage(source=["."])
549+
self.start_import_stop(cov, "empty")
550+
report = self.get_report(cov, precision=6, squeeze=False)
551+
552+
# Name Stmts Miss Cover
553+
# -----------------------------------------
554+
# empty.py 0 0 100.000000%
555+
# not_covered.py 3 3 0.000000%
556+
# -----------------------------------------
557+
# TOTAL 3 3 0.000000%
558+
559+
assert self.line_count(report) == 6, report
560+
assert "empty.py 0 0 100.000000%" in report
561+
assert "not_covered.py 3 3 0.000000%" in report
562+
assert "TOTAL 3 3 0.000000%" in report
563+
541564
def test_dotpy_not_python(self):
542565
# We run a .py file, and when reporting, we can't parse it as Python.
543566
# We should get an error message in the report.

0 commit comments

Comments
 (0)