Example #1
0
 def test_chop_partial(self):
     size = 3
     self.assert_iter_equal(
         chopped(windowed(range(4), size, 1, partial=True), size),
         [(0, 1, 2), (1, 2, 3)])
     self.assert_iter_equal(
         chopped(chunked(range(7), size, partial=True), size), [(0, 1, 2),
                                                                (3, 4, 5)])
Example #2
0
 def test_values(self):
     for value in [-1, 1, 10]:
         for input_ in [-1, None, 0]:
             self.assert_iter_equal(chopped(paired(range(value)), input_),
                                    [])
Example #3
0
 def test_empty(self):
     for value in [-1, None, 0, 1]:
         self.assert_iter_equal(chopped(paired(range(0)), value), [])
Example #4
0
 def test_chop_partial(self):
     size = 3
     self.assert_iter_equal(chopped(windowed(range(4), size, 1, partial=True), size), [(0, 1, 2), (1, 2, 3)])
     self.assert_iter_equal(chopped(chunked(range(7), size, partial=True), size), [(0, 1, 2), (3, 4, 5)])
Example #5
0
 def test_values(self):
     for value in [-1, 1, 10]:
         for input_ in [-1, None, 0]:
             self.assert_iter_equal(chopped(paired(range(value)), input_), [])
Example #6
0
 def test_empty(self):
     for value in [-1, None, 0, 1]:
         self.assert_iter_equal(chopped(paired(range(0)), value), [])