Beispiel #1
0
 def test_none_array(self):
   self.assertEquals(chunk(None, 1), [])
Beispiel #2
0
 def test_empty_array(self):
   self.assertEquals(chunk([], 1), [])
Beispiel #3
0
 def test_invalidates_negative_size(self):
   with self.assertRaises(ValueError):
     self.assertRaises(chunk([1, 2, 3], -1))
Beispiel #4
0
 def test_invalidates_zeroed_size(self):
   with self.assertRaises(ValueError):
     self.assertRaises(chunk([1, 2, 3], 0))
Beispiel #5
0
 def test_size_greather_than_input(self):
   self.assertEquals(chunk([1, 2, 3], 4), [[1, 2, 3]])
Beispiel #6
0
 def test_smaller_last_chunk(self):
   self.assertEquals(chunk([1, 2, 3, 4, 5], 2), [[1, 2], [3, 4], [5]])
Beispiel #7
0
 def test_equal_sized_chunks(self):
   self.assertEquals(chunk([1, 2, 3, 4], 2), [[1, 2], [3, 4]])
Beispiel #8
0
 def test_split_to_single_sized_chunks(self):
   self.assertEquals(chunk([1, 2, 3], 1), [[1], [2], [3]])
Beispiel #9
0
 def test_single_element_array(self):
   self.assertEquals(chunk([1], 1), [[1]])