summaryrefslogtreecommitdiff
path: root/tests/test_xml.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-01-16 20:22:05 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-01-16 20:22:05 -0500
commita5d0d273c93744a3ec61de74cb0d0a98999d722a (patch)
treeb7a6296d3f7ec564f4f06f05e39aa4ce24750c78 /tests/test_xml.py
parentea5047df4932852996353b1c4a99f56c8381f2cf (diff)
downloadpython-coveragepy-a5d0d273c93744a3ec61de74cb0d0a98999d722a.tar.gz
Report empty files as 100% instead of 0%, fixes #345
Diffstat (limited to 'tests/test_xml.py')
-rw-r--r--tests/test_xml.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test_xml.py b/tests/test_xml.py
index 3c7d236..bc8c051 100644
--- a/tests/test_xml.py
+++ b/tests/test_xml.py
@@ -96,7 +96,14 @@ class XmlReportTest(CoverageTest):
xml = self.stdout()
empty_line = re_line(xml, "class.*empty")
self.assertIn('filename="empty.py"', empty_line)
- self.assertIn('line-rate="0"', empty_line)
+ self.assertIn('line-rate="1"', empty_line)
+
+ def test_empty_file_is_100_not_0(self):
+ cov = self.run_doit()
+ cov.xml_report(outfile="-")
+ xml = self.stdout()
+ init_line = re_line(xml, 'filename="sub/__init__.py"')
+ self.assertIn('line-rate="1"', init_line)
def re_line(text, pat):