From 3fb754d683d4ba71b04952c27feaafcdae7225e1 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 20 Aug 2015 21:28:37 -0400 Subject: CoverageData.read and .write are now inverses of each other. --- tests/test_data.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/test_data.py') diff --git a/tests/test_data.py b/tests/test_data.py index 653a401a..ea6b0df0 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -11,7 +11,7 @@ import re import mock -from coverage.backward import iitems +from coverage.backward import iitems, StringIO from coverage.data import CoverageData, CoverageDataFiles, debug_main from coverage.files import PathAliases, canonical_filename from coverage.misc import CoverageException @@ -393,6 +393,17 @@ class CoverageDataTest(DataTestHelpers, CoverageTest): covdata.touch_file("abc.py") self.assertTrue(covdata.has_arcs()) + def test_read_and_write_are_opposites(self): + covdata1 = CoverageData() + covdata1.add_arcs(ARCS_3) + stringio = StringIO() + covdata1.write(stringio) + + stringio.seek(0) + covdata2 = CoverageData() + covdata2.read(stringio) + self.assert_arcs3_data(covdata2) + class CoverageDataTestInTempDir(DataTestHelpers, CoverageTest): """Tests of CoverageData that need a temporary directory to make files.""" -- cgit v1.2.1