def test_collate_when_object_is_key(self): self.failUnlessEqual( [(1, [1])], list(bulk.collate([1], object_is_key))) self.failUnlessEqual( [(1, [1]), (2, [2, 2])], sorted(bulk.collate([1, 2, 2], object_is_key)))
def test_collate_with_key_function(self): self.failUnlessEqual( [(4, ['fred', 'joss']), (6, ['barney'])], sorted(bulk.collate(['fred', 'barney', 'joss'], len)))
def test_collate_empty_list(self): self.failUnlessEqual([], list(bulk.collate([], object_is_key)))
def test_collate_with_key_function(self): self.failUnlessEqual([(4, ['fred', 'joss']), (6, ['barney'])], sorted( bulk.collate(['fred', 'barney', 'joss'], len)))
def test_collate_when_object_is_key(self): self.failUnlessEqual([(1, [1])], list(bulk.collate([1], object_is_key))) self.failUnlessEqual([(1, [1]), (2, [2, 2])], sorted(bulk.collate([1, 2, 2], object_is_key)))