summaryrefslogtreecommitdiff
path: root/tests/coveragetest.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-07-08 06:25:17 -0400
committerNed Batchelder <ned@nedbatchelder.com>2014-07-08 06:25:17 -0400
commitc317727542e303ae9dd5ed4db73217508e367d74 (patch)
treea10fcf53481e773f1ab97eef8188b89172a68404 /tests/coveragetest.py
parenta63bf56c15835c763f60ff0ba3f782c8fb86363c (diff)
downloadpython-coveragepy-git-c317727542e303ae9dd5ed4db73217508e367d74.tar.gz
Improve branch summarization
It failed completely on more than one file! Removed the Branches label, and no longer report missing branches implied by missing lines.
Diffstat (limited to 'tests/coveragetest.py')
-rw-r--r--tests/coveragetest.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index 0171ec14..1eedad39 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -489,15 +489,24 @@ class CoverageTest(TestCase):
self.assertNotIn("error", report.lower())
return report
+ def report_lines(self, report):
+ """Return the lines of the report, as a list."""
+ lines = report.split('\n')
+ self.assertEqual(lines[-1], "")
+ return lines[:-1]
+
def line_count(self, report):
"""How many lines are in `report`?"""
- self.assertEqual(report.split('\n')[-1], "")
- return len(report.split('\n')) - 1
+ return len(self.report_lines(report))
+
+ def squeezed_lines(self, report):
+ """Return a list of the lines in report, with the spaces squeezed."""
+ lines = self.report_lines(report)
+ return [re.sub(r"\s+", " ", l.strip()) for l in lines]
def last_line_squeezed(self, report):
"""Return the last line of `report` with the spaces squeezed down."""
- last_line = report.split('\n')[-2]
- return re.sub(r"\s+", " ", last_line)
+ return self.squeezed_lines(report)[-1]
# We run some tests in temporary directories, because they may need to make
# files for the tests. But this is expensive, so we can change per-class