386
386
self.assertWalkerNext(u'c/d', 'b-id', True, [u'c/d', u'b'], iterator)
387
387
self.assertWalkerNext(u'c/e', 'a-id', True, [u'a', u'a'], iterator)
388
388
self.assertRaises(StopIteration, iterator.next)
390
def assertCmpByDirblock(self, cmp_val, path1, path2):
391
self.assertEqual(cmp_val,
392
_mod_tree.MultiWalker._cmp_path_by_dirblock(path1, path2))
394
def test__cmp_path_by_dirblock(self):
395
# We only support Unicode strings at this point
396
self.assertRaises(TypeError,
397
_mod_tree.MultiWalker._cmp_path_by_dirblock, '', 'b')
398
self.assertCmpByDirblock(0, u'', u'')
399
self.assertCmpByDirblock(0, u'a', u'a')
400
self.assertCmpByDirblock(0, u'a/b', u'a/b')
401
self.assertCmpByDirblock(0, u'a/b/c', u'a/b/c')
402
self.assertCmpByDirblock(1, u'a-a', u'a')
403
self.assertCmpByDirblock(-1, u'a-a', u'a/a')
404
self.assertCmpByDirblock(-1, u'a=a', u'a/a')
405
self.assertCmpByDirblock(1, u'a-a/a', u'a/a')
406
self.assertCmpByDirblock(1, u'a=a/a', u'a/a')
407
self.assertCmpByDirblock(1, u'a-a/a', u'a/a/a')
408
self.assertCmpByDirblock(1, u'a=a/a', u'a/a/a')
409
self.assertCmpByDirblock(1, u'a-a/a/a', u'a/a/a')
410
self.assertCmpByDirblock(1, u'a=a/a/a', u'a/a/a')
412
def assertPathKey(self, expected, path):
413
self.assertEqual(expected, _mod_tree.MultiWalker._path_key(path))
415
def test__path_key(self):
416
self.assertPathKey(([u''], u''), u'')
417
self.assertPathKey(([u''], u'a'), u'a')
418
self.assertPathKey(([u'a'], u'b'), u'a/b')
419
self.assertPathKey(([u'a', u'b'], u'c'), u'a/b/c')