diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-02-06 07:21:13 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-02-06 07:38:49 -0500 |
commit | 2e4b2977c78e254797d07c39e933fd535d4b0cec (patch) | |
tree | 568340a9837fabafee6a818db905d8ec15112d8d /tests/test_context.py | |
parent | b7160a896252bb92ffe921a37e3cde98c5cb78b9 (diff) | |
download | python-coveragepy-git-2e4b2977c78e254797d07c39e933fd535d4b0cec.tar.gz |
refactor: remove unittest.assertCountEqual
Another step toward removing unittest.TestCase.
Diffstat (limited to 'tests/test_context.py')
-rw-r--r-- | tests/test_context.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/test_context.py b/tests/test_context.py index 418849d5..20b7a290 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -12,6 +12,7 @@ from coverage.context import qualname_from_frame from coverage.data import CoverageData from tests.coveragetest import CoverageTest +from tests.helpers import assert_count_equal class StaticContextTest(CoverageTest): @@ -22,14 +23,14 @@ class StaticContextTest(CoverageTest): cov = coverage.Coverage() self.start_import_stop(cov, "main") data = cov.get_data() - self.assertCountEqual(data.measured_contexts(), [""]) + assert_count_equal(data.measured_contexts(), [""]) def test_static_context(self): self.make_file("main.py", "a = 1") cov = coverage.Coverage(context="gooey") self.start_import_stop(cov, "main") data = cov.get_data() - self.assertCountEqual(data.measured_contexts(), ["gooey"]) + assert_count_equal(data.measured_contexts(), ["gooey"]) SOURCE = """\ a = 1 @@ -67,7 +68,7 @@ class StaticContextTest(CoverageTest): assert combined.measured_contexts() == {'red', 'blue'} full_names = {os.path.basename(f): f for f in combined.measured_files()} - self.assertCountEqual(full_names, ['red.py', 'blue.py']) + assert_count_equal(full_names, ['red.py', 'blue.py']) fred = full_names['red.py'] fblue = full_names['blue.py'] @@ -92,7 +93,7 @@ class StaticContextTest(CoverageTest): assert combined.measured_contexts() == {'red', 'blue'} full_names = {os.path.basename(f): f for f in combined.measured_files()} - self.assertCountEqual(full_names, ['red.py', 'blue.py']) + assert_count_equal(full_names, ['red.py', 'blue.py']) fred = full_names['red.py'] fblue = full_names['blue.py'] @@ -157,13 +158,14 @@ class DynamicContextTest(CoverageTest): full_names = {os.path.basename(f): f for f in data.measured_files()} fname = full_names["two_tests.py"] - self.assertCountEqual( + assert_count_equal( data.measured_contexts(), - ["", "two_tests.test_one", "two_tests.test_two"]) + ["", "two_tests.test_one", "two_tests.test_two"] + ) def assert_context_lines(context, lines): data.set_query_context(context) - self.assertCountEqual(lines, data.lines(fname)) + assert_count_equal(lines, data.lines(fname)) assert_context_lines("", self.OUTER_LINES) assert_context_lines("two_tests.test_one", self.TEST_ONE_LINES) @@ -178,13 +180,14 @@ class DynamicContextTest(CoverageTest): full_names = {os.path.basename(f): f for f in data.measured_files()} fname = full_names["two_tests.py"] - self.assertCountEqual( + assert_count_equal( data.measured_contexts(), - ["stat", "stat|two_tests.test_one", "stat|two_tests.test_two"]) + ["stat", "stat|two_tests.test_one", "stat|two_tests.test_two"] + ) def assert_context_lines(context, lines): data.set_query_context(context) - self.assertCountEqual(lines, data.lines(fname)) + assert_count_equal(lines, data.lines(fname)) assert_context_lines("stat", self.OUTER_LINES) assert_context_lines("stat|two_tests.test_one", self.TEST_ONE_LINES) |