示例#1
0
 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)))
示例#2
0
 def test_collate_with_key_function(self):
     self.failUnlessEqual(
         [(4, ['fred', 'joss']), (6, ['barney'])],
         sorted(bulk.collate(['fred', 'barney', 'joss'], len)))
示例#3
0
 def test_collate_empty_list(self):
     self.failUnlessEqual([], list(bulk.collate([], object_is_key)))
示例#4
0
 def test_collate_with_key_function(self):
     self.failUnlessEqual([(4, ['fred', 'joss']), (6, ['barney'])],
                          sorted(
                              bulk.collate(['fred', 'barney', 'joss'],
                                           len)))
示例#5
0
 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)))
示例#6
0
 def test_collate_empty_list(self):
     self.failUnlessEqual([], list(bulk.collate([], object_is_key)))