diff options
-rw-r--r-- | coverage/summary.py | 2 | ||||
-rw-r--r-- | test/test_api.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/coverage/summary.py b/coverage/summary.py index 275075d9..8a601a65 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -18,7 +18,7 @@ class SummaryReporter(Reporter): self.find_code_units(morfs, omit_prefixes) # Prepare the formatting strings - max_name = max(5, max(map(lambda cu: len(cu.name), self.code_units))) + max_name = max([5] + map(lambda cu: len(cu.name), self.code_units)) fmt_name = "%%- %ds " % max_name fmt_err = fmt_name + "%s: %s\n" header = fmt_name % "Name" + " Stmts Exec Cover\n" diff --git a/test/test_api.py b/test/test_api.py index ce349329..68f1dc95 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -240,3 +240,9 @@ class ApiTest(CoverageTest): cov.save() self.assert_equal_sets(os.listdir("."), ["datatest3.py", "datatest3.pyc", "cov.data.14"]) + + def testEmptyReporting(self): + # Used to be you'd get an exception reporting on nothing... + cov = coverage.coverage() + cov.erase() + cov.report() |