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)])
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_), [])
def test_empty(self): for value in [-1, None, 0, 1]: self.assert_iter_equal(chopped(paired(range(0)), value), [])
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)])