diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-18 14:09:54 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-18 14:09:54 -0400 |
commit | aa9af88224fac4d25d5bf1d2f4757b8ffd2c22ee (patch) | |
tree | 3697e6162d46fdb6e17b2c6d694314dff19280ec /tests/test_data.py | |
parent | ed2266434af1582cd94c1b89f7172bad62f88745 (diff) | |
download | python-coveragepy-git-aa9af88224fac4d25d5bf1d2f4757b8ffd2c22ee.tar.gz |
Refactor collector->data; data has only one of lines and arcs.
Now the collector communicates directly with the data, and control is less
involved. In the data, when measuring arcs, only arcs are stored. Lines
are calculated as needed. This saves space in the data file, and is faster.
Diffstat (limited to 'tests/test_data.py')
-rw-r--r-- | tests/test_data.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/test_data.py b/tests/test_data.py index cd9fbf35..734c3423 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -41,6 +41,9 @@ ARC_DATA_3 = { } X_PY_ARCS_3 = [(-1, 1), (1, 2), (2, 3), (3, -1)] Y_PY_ARCS_3 = [(-1, 17), (17, 23), (23, -1)] +SUMMARY_3 = {'x.py': 3, 'y.py': 2} +MEASURED_FILES_3 = ['x.py', 'y.py'] +X_PY_LINES_3 = [1, 2, 3] class DataTestHelpers(CoverageTest): @@ -74,11 +77,20 @@ class DataTest(DataTestHelpers, CoverageTest): covdata.add_arcs(ARC_DATA_3) self.assertTrue(covdata) - def test_adding_data(self): + def test_adding_lines(self): covdata = CoverageData() covdata.add_lines(DATA_1) self.assert_line_counts(covdata, SUMMARY_1) self.assert_measured_files(covdata, MEASURED_FILES_1) + self.assertCountEqual(covdata.lines("a.py"), A_PY_LINES_1) + + def test_adding_arcs(self): + covdata = CoverageData() + covdata.add_arcs(ARC_DATA_3) + self.assert_line_counts(covdata, SUMMARY_3) + self.assert_measured_files(covdata, MEASURED_FILES_3) + self.assertCountEqual(covdata.lines("x.py"), X_PY_LINES_3) + self.assertCountEqual(covdata.arcs("x.py"), X_PY_ARCS_3) def test_touch_file(self): covdata = CoverageData() @@ -97,9 +109,6 @@ class DataFilesTest(DataTestHelpers, CoverageTest): self.data_files = CoverageDataFiles() def test_reading_empty(self): - # Make sure there is no .coverage data file here. - if os.path.exists(".coverage"): - os.remove(".coverage") covdata = CoverageData() self.data_files.read(covdata) self.assert_line_counts(covdata, {}) |