--- a/tests/test-match.py Sun Feb 10 21:33:21 2019 -0800
+++ b/tests/test-match.py Sun Feb 10 14:35:36 2019 -0800
@@ -12,36 +12,36 @@
class BaseMatcherTests(unittest.TestCase):
def testVisitdir(self):
- m = matchmod.basematcher(b'', b'')
+ m = matchmod.basematcher()
self.assertTrue(m.visitdir(b'.'))
self.assertTrue(m.visitdir(b'dir'))
def testVisitchildrenset(self):
- m = matchmod.basematcher(b'', b'')
+ m = matchmod.basematcher()
self.assertEqual(m.visitchildrenset(b'.'), b'this')
self.assertEqual(m.visitchildrenset(b'dir'), b'this')
class AlwaysMatcherTests(unittest.TestCase):
def testVisitdir(self):
- m = matchmod.alwaysmatcher(b'', b'')
+ m = matchmod.alwaysmatcher()
self.assertEqual(m.visitdir(b'.'), b'all')
self.assertEqual(m.visitdir(b'dir'), b'all')
def testVisitchildrenset(self):
- m = matchmod.alwaysmatcher(b'', b'')
+ m = matchmod.alwaysmatcher()
self.assertEqual(m.visitchildrenset(b'.'), b'all')
self.assertEqual(m.visitchildrenset(b'dir'), b'all')
class NeverMatcherTests(unittest.TestCase):
def testVisitdir(self):
- m = matchmod.nevermatcher(b'', b'')
+ m = matchmod.nevermatcher()
self.assertFalse(m.visitdir(b'.'))
self.assertFalse(m.visitdir(b'dir'))
def testVisitchildrenset(self):
- m = matchmod.nevermatcher(b'', b'')
+ m = matchmod.nevermatcher()
self.assertEqual(m.visitchildrenset(b'.'), set())
self.assertEqual(m.visitchildrenset(b'dir'), set())
@@ -50,12 +50,12 @@
# this is equivalent to BaseMatcherTests.
def testVisitdir(self):
- m = matchmod.predicatematcher(b'', b'', lambda *a: False)
+ m = matchmod.predicatematcher(lambda *a: False)
self.assertTrue(m.visitdir(b'.'))
self.assertTrue(m.visitdir(b'dir'))
def testVisitchildrenset(self):
- m = matchmod.predicatematcher(b'', b'', lambda *a: False)
+ m = matchmod.predicatematcher(lambda *a: False)
self.assertEqual(m.visitchildrenset(b'.'), b'this')
self.assertEqual(m.visitchildrenset(b'dir'), b'this')
@@ -223,8 +223,8 @@
class DifferenceMatcherTests(unittest.TestCase):
def testVisitdirM2always(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.alwaysmatcher()
dm = matchmod.differencematcher(m1, m2)
# dm should be equivalent to a nevermatcher.
self.assertFalse(dm.visitdir(b'.'))
@@ -236,8 +236,8 @@
self.assertFalse(dm.visitdir(b'folder'))
def testVisitchildrensetM2always(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.alwaysmatcher()
dm = matchmod.differencematcher(m1, m2)
# dm should be equivalent to a nevermatcher.
self.assertEqual(dm.visitchildrenset(b'.'), set())
@@ -249,8 +249,8 @@
self.assertEqual(dm.visitchildrenset(b'folder'), set())
def testVisitdirM2never(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.nevermatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.nevermatcher()
dm = matchmod.differencematcher(m1, m2)
# dm should be equivalent to a alwaysmatcher.
#
@@ -267,8 +267,8 @@
self.assertEqual(dm.visitdir(b'folder'), b'all')
def testVisitchildrensetM2never(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.nevermatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.nevermatcher()
dm = matchmod.differencematcher(m1, m2)
# dm should be equivalent to a alwaysmatcher.
self.assertEqual(dm.visitchildrenset(b'.'), b'all')
@@ -280,7 +280,7 @@
self.assertEqual(dm.visitchildrenset(b'folder'), b'all')
def testVisitdirM2SubdirPrefix(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
dm = matchmod.differencematcher(m1, m2)
self.assertEqual(dm.visitdir(b'.'), True)
@@ -295,7 +295,7 @@
self.assertEqual(dm.visitdir(b'folder'), b'all')
def testVisitchildrensetM2SubdirPrefix(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
dm = matchmod.differencematcher(m1, m2)
self.assertEqual(dm.visitchildrenset(b'.'), b'this')
@@ -344,8 +344,8 @@
class IntersectionMatcherTests(unittest.TestCase):
def testVisitdirM2always(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.alwaysmatcher()
im = matchmod.intersectmatchers(m1, m2)
# im should be equivalent to a alwaysmatcher.
self.assertEqual(im.visitdir(b'.'), b'all')
@@ -357,8 +357,8 @@
self.assertEqual(im.visitdir(b'folder'), b'all')
def testVisitchildrensetM2always(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.alwaysmatcher()
im = matchmod.intersectmatchers(m1, m2)
# im should be equivalent to a alwaysmatcher.
self.assertEqual(im.visitchildrenset(b'.'), b'all')
@@ -370,8 +370,8 @@
self.assertEqual(im.visitchildrenset(b'folder'), b'all')
def testVisitdirM2never(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.nevermatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.nevermatcher()
im = matchmod.intersectmatchers(m1, m2)
# im should be equivalent to a nevermatcher.
self.assertFalse(im.visitdir(b'.'))
@@ -383,8 +383,8 @@
self.assertFalse(im.visitdir(b'folder'))
def testVisitchildrensetM2never(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.nevermatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.nevermatcher()
im = matchmod.intersectmatchers(m1, m2)
# im should be equivalent to a nevermqtcher.
self.assertEqual(im.visitchildrenset(b'.'), set())
@@ -396,7 +396,7 @@
self.assertEqual(im.visitchildrenset(b'folder'), set())
def testVisitdirM2SubdirPrefix(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
im = matchmod.intersectmatchers(m1, m2)
self.assertEqual(im.visitdir(b'.'), True)
@@ -411,7 +411,7 @@
self.assertEqual(im.visitdir(b'dir/subdir/x'), True)
def testVisitchildrensetM2SubdirPrefix(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
im = matchmod.intersectmatchers(m1, m2)
self.assertEqual(im.visitchildrenset(b'.'), {b'dir'})
@@ -536,8 +536,8 @@
class UnionMatcherTests(unittest.TestCase):
def testVisitdirM2always(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.alwaysmatcher()
um = matchmod.unionmatcher([m1, m2])
# um should be equivalent to a alwaysmatcher.
self.assertEqual(um.visitdir(b'.'), b'all')
@@ -549,8 +549,8 @@
self.assertEqual(um.visitdir(b'folder'), b'all')
def testVisitchildrensetM2always(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.alwaysmatcher()
um = matchmod.unionmatcher([m1, m2])
# um should be equivalent to a alwaysmatcher.
self.assertEqual(um.visitchildrenset(b'.'), b'all')
@@ -562,8 +562,8 @@
self.assertEqual(um.visitchildrenset(b'folder'), b'all')
def testVisitdirM1never(self):
- m1 = matchmod.nevermatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.nevermatcher()
+ m2 = matchmod.alwaysmatcher()
um = matchmod.unionmatcher([m1, m2])
# um should be equivalent to a alwaysmatcher.
self.assertEqual(um.visitdir(b'.'), b'all')
@@ -575,8 +575,8 @@
self.assertEqual(um.visitdir(b'folder'), b'all')
def testVisitchildrensetM1never(self):
- m1 = matchmod.nevermatcher(b'', b'')
- m2 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.nevermatcher()
+ m2 = matchmod.alwaysmatcher()
um = matchmod.unionmatcher([m1, m2])
# um should be equivalent to a alwaysmatcher.
self.assertEqual(um.visitchildrenset(b'.'), b'all')
@@ -588,8 +588,8 @@
self.assertEqual(um.visitchildrenset(b'folder'), b'all')
def testVisitdirM2never(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.nevermatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.nevermatcher()
um = matchmod.unionmatcher([m1, m2])
# um should be equivalent to a alwaysmatcher.
self.assertEqual(um.visitdir(b'.'), b'all')
@@ -601,8 +601,8 @@
self.assertEqual(um.visitdir(b'folder'), b'all')
def testVisitchildrensetM2never(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
- m2 = matchmod.nevermatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
+ m2 = matchmod.nevermatcher()
um = matchmod.unionmatcher([m1, m2])
# um should be equivalent to a alwaysmatcher.
self.assertEqual(um.visitchildrenset(b'.'), b'all')
@@ -614,7 +614,7 @@
self.assertEqual(um.visitchildrenset(b'folder'), b'all')
def testVisitdirM2SubdirPrefix(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
um = matchmod.unionmatcher([m1, m2])
self.assertEqual(um.visitdir(b'.'), b'all')
@@ -626,7 +626,7 @@
self.assertEqual(um.visitdir(b'dir/subdir/x'), b'all')
def testVisitchildrensetM2SubdirPrefix(self):
- m1 = matchmod.alwaysmatcher(b'', b'')
+ m1 = matchmod.alwaysmatcher()
m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
um = matchmod.unionmatcher([m1, m2])
self.assertEqual(um.visitchildrenset(b'.'), b'all')
@@ -777,7 +777,7 @@
def testVisitdir(self):
m = matchmod.match(util.localpath(b'root/d'), b'e/f',
[b'../a.txt', b'b.txt'])
- pm = matchmod.prefixdirmatcher(b'root', b'd/e/f', b'd', m)
+ pm = matchmod.prefixdirmatcher(b'd', m)
# `m` elides 'd' because it's part of the root, and the rest of the
# patterns are relative.
@@ -809,7 +809,7 @@
def testVisitchildrenset(self):
m = matchmod.match(util.localpath(b'root/d'), b'e/f',
[b'../a.txt', b'b.txt'])
- pm = matchmod.prefixdirmatcher(b'root', b'd/e/f', b'd', m)
+ pm = matchmod.prefixdirmatcher(b'd', m)
# OPT: visitchildrenset could possibly return {'e'} and {'f'} for these
# next two, respectively; patternmatcher does not have this