diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-05-31 23:12:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-05-31 23:12:40 -0400 |
commit | 139497ac9cf495a13e9f3323db489bf56054f5d4 (patch) | |
tree | eae49dfbee407d333ef61618351936ded5945297 /test/test_api.py | |
parent | 61deec574e9d0181ad986d1276e3d57e8427930d (diff) | |
download | python-coveragepy-git-139497ac9cf495a13e9f3323db489bf56054f5d4.tar.gz |
Better handling of the partial-branch exclusion regexes. Finishes issue #113.
Diffstat (limited to 'test/test_api.py')
-rw-r--r-- | test/test_api.py | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/test/test_api.py b/test/test_api.py index 0a0aabfd..ae31404d 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -220,10 +220,43 @@ class ApiTest(CoverageTest): self.assertEqual(cov.get_exclude_list(), ["foo"]) cov.exclude("bar") self.assertEqual(cov.get_exclude_list(), ["foo", "bar"]) - self.assertEqual(cov.exclude_re, "(foo)|(bar)") + self.assertEqual(cov._exclude_regex('exclude'), "(foo)|(bar)") cov.clear_exclude() self.assertEqual(cov.get_exclude_list(), []) + def test_exclude_partial_list(self): + cov = coverage.coverage() + cov.clear_exclude(which='partial') + self.assertEqual(cov.get_exclude_list(which='partial'), []) + cov.exclude("foo", which='partial') + self.assertEqual(cov.get_exclude_list(which='partial'), ["foo"]) + cov.exclude("bar", which='partial') + self.assertEqual(cov.get_exclude_list(which='partial'), ["foo", "bar"]) + self.assertEqual(cov._exclude_regex(which='partial'), "(foo)|(bar)") + cov.clear_exclude(which='partial') + self.assertEqual(cov.get_exclude_list(which='partial'), []) + + def test_exclude_and_partial_are_separate_lists(self): + cov = coverage.coverage() + cov.clear_exclude(which='partial') + cov.clear_exclude(which='exclude') + cov.exclude("foo", which='partial') + self.assertEqual(cov.get_exclude_list(which='partial'), ['foo']) + self.assertEqual(cov.get_exclude_list(which='exclude'), []) + cov.exclude("bar", which='exclude') + self.assertEqual(cov.get_exclude_list(which='partial'), ['foo']) + self.assertEqual(cov.get_exclude_list(which='exclude'), ['bar']) + cov.exclude("p2", which='partial') + cov.exclude("e2", which='exclude') + self.assertEqual(cov.get_exclude_list(which='partial'), ['foo', 'p2']) + self.assertEqual(cov.get_exclude_list(which='exclude'), ['bar', 'e2']) + cov.clear_exclude(which='partial') + self.assertEqual(cov.get_exclude_list(which='partial'), []) + self.assertEqual(cov.get_exclude_list(which='exclude'), ['bar', 'e2']) + cov.clear_exclude(which='exclude') + self.assertEqual(cov.get_exclude_list(which='partial'), []) + self.assertEqual(cov.get_exclude_list(which='exclude'), []) + def test_datafile_default(self): # Default data file behavior: it's .coverage self.make_file("datatest1.py", """\ |