def test_iterator_goto(self): shape = [3, 5] strides = [1, 3] backstrides = [x * (y - 1) for x, y in zip(strides, shape)] assert backstrides == [2, 12] a = MockArray(shape, strides, 42) i = ArrayIter(a, support.product(shape), shape, strides, backstrides) assert not i.contiguous s = i.reset() assert s.index == 0 assert s._indices == [0, 0] assert s.offset == a.start s = i.goto(11) assert s.index == 11 assert s._indices is None assert s.offset == a.start + 5
def test_iterator_goto(self): shape = [3, 5] strides = [1, 3] backstrides = [x * (y - 1) for x,y in zip(strides, shape)] assert backstrides == [2, 12] a = MockArray(shape, strides, 42) i = ArrayIter(a, support.product(shape), shape, strides, backstrides) assert not i.contiguous s = i.reset() assert s.index == 0 assert s._indices == [0, 0] assert s.offset == a.start s = i.goto(11) assert s.index == 11 assert s._indices is None assert s.offset == a.start + 5