From d918e93a2a87aa730932d901b3bc19291b1a2dc9 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 6 Sep 2013 22:09:26 -0400 Subject: Give the matchers a way to get info out of them. --- tests/test_files.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/test_files.py') diff --git a/tests/test_files.py b/tests/test_files.py index 509c23b..eeb2264 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -58,16 +58,19 @@ class MatcherTest(CoverageTest): file4 = self.make_file("sub3/file4.py") file5 = self.make_file("sub3/file5.c") fl = FileLocator() - tm = TreeMatcher([ + trees = [ fl.canonical_filename("sub"), fl.canonical_filename(file4), - ]) + ] + tm = TreeMatcher(trees) self.assertTrue(tm.match(fl.canonical_filename(file1))) self.assertTrue(tm.match(fl.canonical_filename(file2))) self.assertFalse(tm.match(fl.canonical_filename(file3))) self.assertTrue(tm.match(fl.canonical_filename(file4))) self.assertFalse(tm.match(fl.canonical_filename(file5))) + self.assertEqual(tm.info(), trees) + def test_fnmatch_matcher(self): file1 = self.make_file("sub/file1.py") file2 = self.make_file("sub/file2.c") @@ -82,6 +85,8 @@ class MatcherTest(CoverageTest): self.assertTrue(fnm.match(fl.canonical_filename(file4))) self.assertFalse(fnm.match(fl.canonical_filename(file5))) + self.assertEqual(fnm.info(), ["*.py", "*/sub2/*"]) + class PathAliasesTest(CoverageTest): """Tests for coverage/files.py:PathAliases""" -- cgit v1.2.1