From d9bc47d0db97ea47ebbe1b775947049792e8aa00 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 3 Sep 2019 13:36:10 -0400 Subject: Updating with an empty data is ok With no arc or line data, it used to choose lines arbitrarily, which would fail if an empty data was updating an arc data. --- tests/test_data.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/test_data.py b/tests/test_data.py index e09aaf44..eb389e35 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -428,6 +428,22 @@ class CoverageDataTest(DataTestHelpers, CoverageTest): with self.assertRaisesRegex(CoverageException, msg): covdata2.update(covdata1) + def test_update_lines_empty(self): + covdata1 = CoverageData(suffix='1') + covdata1.add_lines(LINES_1) + + covdata2 = CoverageData(suffix='2') + covdata1.update(covdata2) + self.assert_line_counts(covdata1, SUMMARY_1) + + def test_update_arcs_empty(self): + covdata1 = CoverageData(suffix='1') + covdata1.add_arcs(ARCS_3) + + covdata2 = CoverageData(suffix='2') + covdata1.update(covdata2) + self.assert_line_counts(covdata1, SUMMARY_3) + def test_asking_isnt_measuring(self): # Asking about an unmeasured file shouldn't make it seem measured. covdata = CoverageData() -- cgit v1.2.1