Esempio n. 1
0
 def testVisitchildrensetM2never(self):
     m1 = matchmod.alwaysmatcher(b'', b'')
     m2 = matchmod.nevermatcher(b'', b'')
     um = matchmod.unionmatcher([m1, m2])
     # um should be equivalent to a alwaysmatcher.
     self.assertEqual(um.visitchildrenset(b'.'), b'all')
     self.assertEqual(um.visitchildrenset(b'dir'), b'all')
     self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
     self.assertEqual(um.visitchildrenset(b'dir/subdir/z'), b'all')
     self.assertEqual(um.visitchildrenset(b'dir/foo'), b'all')
     self.assertEqual(um.visitchildrenset(b'dir/subdir/x'), b'all')
     self.assertEqual(um.visitchildrenset(b'folder'), b'all')
Esempio n. 2
0
 def testVisitchildrensetM2never(self):
     m1 = matchmod.alwaysmatcher(b'', b'')
     m2 = matchmod.nevermatcher(b'', b'')
     im = matchmod.intersectmatchers(m1, m2)
     # im should be equivalent to a nevermqtcher.
     self.assertEqual(im.visitchildrenset(b'.'), set())
     self.assertEqual(im.visitchildrenset(b'dir'), set())
     self.assertEqual(im.visitchildrenset(b'dir/subdir'), set())
     self.assertEqual(im.visitchildrenset(b'dir/subdir/z'), set())
     self.assertEqual(im.visitchildrenset(b'dir/foo'), set())
     self.assertEqual(im.visitchildrenset(b'dir/subdir/x'), set())
     self.assertEqual(im.visitchildrenset(b'folder'), set())
Esempio n. 3
0
 def testVisitdirM2never(self):
     m1 = matchmod.alwaysmatcher(b'', b'')
     m2 = matchmod.nevermatcher(b'', b'')
     im = matchmod.intersectmatchers(m1, m2)
     # im should be equivalent to a nevermatcher.
     self.assertFalse(im.visitdir(b'.'))
     self.assertFalse(im.visitdir(b'dir'))
     self.assertFalse(im.visitdir(b'dir/subdir'))
     self.assertFalse(im.visitdir(b'dir/subdir/z'))
     self.assertFalse(im.visitdir(b'dir/foo'))
     self.assertFalse(im.visitdir(b'dir/subdir/x'))
     self.assertFalse(im.visitdir(b'folder'))
Esempio n. 4
0
 def testVisitchildrensetM2never(self):
     m1 = matchmod.alwaysmatcher(b'', b'')
     m2 = matchmod.nevermatcher(b'', b'')
     dm = matchmod.differencematcher(m1, m2)
     # dm should be equivalent to a alwaysmatcher.
     self.assertEqual(dm.visitchildrenset(b'.'), b'all')
     self.assertEqual(dm.visitchildrenset(b'dir'), b'all')
     self.assertEqual(dm.visitchildrenset(b'dir/subdir'), b'all')
     self.assertEqual(dm.visitchildrenset(b'dir/subdir/z'), b'all')
     self.assertEqual(dm.visitchildrenset(b'dir/foo'), b'all')
     self.assertEqual(dm.visitchildrenset(b'dir/subdir/x'), b'all')
     self.assertEqual(dm.visitchildrenset(b'folder'), b'all')
Esempio n. 5
0
 def testVisitdirM2never(self):
     m1 = matchmod.alwaysmatcher(b'', b'')
     m2 = matchmod.nevermatcher(b'', b'')
     dm = matchmod.differencematcher(m1, m2)
     # dm should be equivalent to a alwaysmatcher. OPT: if m2 is a
     # nevermatcher, we could return 'all' for these.
     #
     # We're testing Equal-to-True instead of just 'assertTrue' since
     # assertTrue does NOT verify that it's a bool, just that it's truthy.
     # While we may want to eventually make these return 'all', they should
     # not currently do so.
     self.assertEqual(dm.visitdir(b'.'), True)
     self.assertEqual(dm.visitdir(b'dir'), True)
     self.assertEqual(dm.visitdir(b'dir/subdir'), True)
     self.assertEqual(dm.visitdir(b'dir/subdir/z'), True)
     self.assertEqual(dm.visitdir(b'dir/foo'), True)
     self.assertEqual(dm.visitdir(b'dir/subdir/x'), True)
     self.assertEqual(dm.visitdir(b'folder'), True)
Esempio n. 6
0
 def testVisitdir(self):
     m = matchmod.nevermatcher('', '')
     self.assertFalse(m.visitdir('.'))
     self.assertFalse(m.visitdir('dir'))
Esempio n. 7
0
 def testVisitchildrenset(self):
     m = matchmod.nevermatcher(b'', b'')
     self.assertEqual(m.visitchildrenset(b'.'), set())
     self.assertEqual(m.visitchildrenset(b'dir'), set())