def test_group_deeper_dir(self): paths = frozenset(("a/b/1", "a/b/2", "a/b/3", "a/b/4", "c")) self.assertEqual( group_large_dirs(paths), { '': set(['a/b', 'c']), 'a/b': set(['a/b/1', 'a/b/2', 'a/b/3', 'a/b/4']) })
def test_group_container(self): paths = frozenset(( "a/1", "a/2", "a/3", "a", )) self.assertEqual(group_large_dirs(paths), { '': set(['a']), 'a': set(['a/1', 'a/2', 'a/3']) })
def test_bug_580798(self): # Test for Bug #580798 paths = frozenset(( 'a', 'a/b1/c1', 'a/b2/d1', 'a/b2/d2', 'a/b2/d3', 'a/b2/d4', )) self.assertEqual( group_large_dirs(paths), { '': set(['a']), 'a': set(['a/b1/c1', 'a/b2']), 'a/b2': set(['a/b2/d1', 'a/b2/d2', 'a/b2/d3', 'a/b2/d4']), })
def test_subdir_included(self): paths = frozenset([ u'b', u'b/1', u'b/2', u'b/3', u'b/4', u'b/c', u'b/c/1', u'b/c/2', u'b/c/3', u'b/c/4', ]) self.assertEqual( group_large_dirs(paths), { '': set([u'b']), u'b': set([u'b/1', u'b/2', u'b/3', u'b/4', u'b/c']), u'b/c': set([u'b/c/1', u'b/c/2', u'b/c/3', u'b/c/4']) })
def test_no_paths(self): paths = frozenset() self.assertEqual(group_large_dirs(paths), {'': set([])})
def test_group_large_and_parents_with_others(self): paths = frozenset(("a/1", "a/2", "a/3", "a/4", "b")) self.assertEqual(group_large_dirs(paths), { '': set(['a', 'b']), 'a': set(['a/1', 'a/2', 'a/3', 'a/4']) })
def test_no_group_no_parents_with_others(self): paths = frozenset(("a/1", "a/2", "a/3", "a/4")) self.assertEqual(group_large_dirs(paths), {"": paths})
def test_no_group_small(self): paths = frozenset(("a/1", "a/2", "a/3", "b")) self.assertEqual(group_large_dirs(paths), {"": paths})