def test_slice_array_2d(): #2d slices: x[13::2,10::1] expected = { ('y', 0, 0): (getitem, ('x', 0, 0), (slice(13, 20, 2), slice(10, 20, 1))), ('y', 0, 1): (getitem, ('x', 0, 1), (slice(13, 20, 2), slice(None, None, None))), ('y', 0, 2): (getitem, ('x', 0, 2), (slice(13, 20, 2), slice(None, None, None))) } result, chunks = slice_array( 'y', 'x', [[20], [20, 20, 5]], [slice(13, None, 2), slice(10, None, 1)]) assert expected == result #2d slices with one dimension: x[5,10::1] expected = { ('y', 0): (getitem, ('x', 0, 0), (5, slice(10, 20, 1))), ('y', 1): (getitem, ('x', 0, 1), (5, slice(None, None, None))), ('y', 2): (getitem, ('x', 0, 2), (5, slice(None, None, None))) } result, chunks = slice_array('y', 'x', ([20], [20, 20, 5]), [5, slice(10, None, 1)]) assert expected == result
def test_uneven_blockdims(): blockdims = ((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30), (100, )) index = (slice(240, 270), slice(None)) dsk_out, bd_out = slice_array("in", "out", blockdims, index, itemsize=8) sol = { ("in", 0, 0): (getitem, ("out", 7, 0), (slice(28, 31, 1), slice(None))), ("in", 1, 0): (getitem, ("out", 8, 0), (slice(0, 27, 1), slice(None))), } assert dsk_out == sol assert bd_out == ((3, 27), (100, )) blockdims = ((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30), ) * 2 index = (slice(240, 270), slice(180, 230)) dsk_out, bd_out = slice_array("in", "out", blockdims, index, itemsize=8) sol = { ("in", 0, 0): (getitem, ("out", 7, 5), (slice(28, 31, 1), slice(29, 30, 1))), ("in", 0, 1): (getitem, ("out", 7, 6), (slice(28, 31, 1), slice(None))), ("in", 0, 2): (getitem, ("out", 7, 7), (slice(28, 31, 1), slice(0, 18, 1))), ("in", 1, 0): (getitem, ("out", 8, 5), (slice(0, 27, 1), slice(29, 30, 1))), ("in", 1, 1): (getitem, ("out", 8, 6), (slice(0, 27, 1), slice(None))), ("in", 1, 2): (getitem, ("out", 8, 7), (slice(0, 27, 1), slice(0, 18, 1))), } assert dsk_out == sol assert bd_out == ((3, 27), (1, 31, 18))
def test_slice_array_2d(): #2d slices: x[13::2,10::1] expected = {('y', 0, 0): (getitem, ('x', 0, 0), (slice(13, 20, 2), slice(10, 20, 1))), ('y', 0, 1): (getitem, ('x', 0, 1), (slice(13, 20, 2), slice(None, None, None))), ('y', 0, 2): (getitem, ('x', 0, 2), (slice(13, 20, 2), slice(None, None, None)))} result, chunks = slice_array('y', 'x', [[20], [20, 20, 5]], [slice(13, None, 2), slice(10, None, 1)]) assert expected == result #2d slices with one dimension: x[5,10::1] expected = {('y', 0): (getitem, ('x', 0, 0), (5, slice(10, 20, 1))), ('y', 1): (getitem, ('x', 0, 1), (5, slice(None, None, None))), ('y', 2): (getitem, ('x', 0, 2), (5, slice(None, None, None)))} result, chunks = slice_array('y', 'x', ([20], [20, 20, 5]), [5, slice(10, None, 1)]) assert expected == result
def test_slice_array_1d(): #x[24::2] expected = {('y', 0): (getitem, ('x', 0), (slice(24, 25, 2),)), ('y', 1): (getitem, ('x', 1), (slice(1, 25, 2),)), ('y', 2): (getitem, ('x', 2), (slice(0, 25, 2),)), ('y', 3): (getitem, ('x', 3), (slice(1, 25, 2),))} result, chunks = slice_array('y', 'x', [[25] * 4], [slice(24, None, 2)]) assert expected == result #x[26::2] expected = {('y', 0): (getitem, ('x', 1), (slice(1, 25, 2),)), ('y', 1): (getitem, ('x', 2), (slice(0, 25, 2),)), ('y', 2): (getitem, ('x', 3), (slice(1, 25, 2),))} result, chunks = slice_array('y', 'x', [[25] * 4], [slice(26, None, 2)]) assert expected == result #x[24::2] expected = {('y', 0): (getitem, ('x', 0), (slice(24, 25, 2),)), ('y', 1): (getitem, ('x', 1), (slice(1, 25, 2),)), ('y', 2): (getitem, ('x', 2), (slice(0, 25, 2),)), ('y', 3): (getitem, ('x', 3), (slice(1, 25, 2),))} result, chunks = slice_array('y', 'x', [(25, ) * 4], (slice(24, None, 2), )) assert expected == result #x[26::2] expected = {('y', 0): (getitem, ('x', 1), (slice(1, 25, 2),)), ('y', 1): (getitem, ('x', 2), (slice(0, 25, 2),)), ('y', 2): (getitem, ('x', 3), (slice(1, 25, 2),))} result, chunks = slice_array('y', 'x', [(25, ) * 4], (slice(26, None, 2), )) assert expected == result
def test_uneven_blockdims(): blockdims = ((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30), (100, )) index = (slice(240, 270), slice(None)) dsk_out, bd_out = slice_array('in', 'out', blockdims, index) sol = { ('in', 0, 0): (getitem, ('out', 7, 0), (slice(28, 31, 1), slice(None))), ('in', 1, 0): (getitem, ('out', 8, 0), (slice(0, 27, 1), slice(None))) } assert dsk_out == sol assert bd_out == ((3, 27), (100, )) blockdims = ((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30), ) * 2 index = (slice(240, 270), slice(180, 230)) dsk_out, bd_out = slice_array('in', 'out', blockdims, index) sol = { ('in', 0, 0): (getitem, ('out', 7, 5), (slice(28, 31, 1), slice(29, 30, 1))), ('in', 0, 1): (getitem, ('out', 7, 6), (slice(28, 31, 1), slice(None))), ('in', 0, 2): (getitem, ('out', 7, 7), (slice(28, 31, 1), slice(0, 18, 1))), ('in', 1, 0): (getitem, ('out', 8, 5), (slice(0, 27, 1), slice(29, 30, 1))), ('in', 1, 1): (getitem, ('out', 8, 6), (slice(0, 27, 1), slice(None))), ('in', 1, 2): (getitem, ('out', 8, 7), (slice(0, 27, 1), slice(0, 18, 1))) } assert dsk_out == sol assert bd_out == ((3, 27), (1, 31, 18))
def test_slicing_with_numpy_arrays(): a, bd1 = slice_array( "y", "x", ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([1, 2, 9]), slice(None, None, None)), itemsize=8, ) b, bd2 = slice_array( "y", "x", ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([1, 2, 9]), slice(None, None, None)), itemsize=8, ) assert bd1 == bd2 np.testing.assert_equal(a, b) i = [False, True, True, False, False, False, False, False, False, True] index = (i, slice(None, None, None)) index = normalize_index(index, (10, 10)) c, bd3 = slice_array("y", "x", ((3, 3, 3, 1), (3, 3, 3, 1)), index, itemsize=8) assert bd1 == bd3 np.testing.assert_equal(a, c)
def test_slicing_chunks(): result, chunks = slice_array("y", "x", ([5, 5], [5, 5]), (1, [2, 0, 3])) assert chunks == ((3,),) result, chunks = slice_array("y", "x", ([5, 5], [5, 5]), (slice(0, 7), [2, 0, 3])) assert chunks == ((5, 2), (3,)) result, chunks = slice_array("y", "x", ([5, 5], [5, 5]), (slice(0, 7), 1)) assert chunks == ((5, 2),)
def test_slicing_chunks(): result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (1, [2, 0, 3])) assert chunks == ((3, ), ) result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), [2, 0, 3])) assert chunks == ((5, 2), (3, )) result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), 1)) assert chunks == ((5, 2), )
def test_slicing_blockdims(): result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (1, [2, 0, 3])) assert blockdims == ((3, ), ) result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), [2, 0, 3])) assert blockdims == ((5, 2), (3, )) result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), 1)) assert blockdims == ((5, 2), )
def test_slicing_with_numpy_arrays(): a, bd1 = slice_array("y", "x", ((3, 3, 3, 1), (3, 3, 3, 1)), ([1, 2, 9], slice(None, None, None))) b, bd2 = slice_array("y", "x", ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([1, 2, 9]), slice(None, None, None))) assert bd1 == bd2 assert a == b i = [False, True, True, False, False, False, False, False, False, True, False] c, bd3 = slice_array("y", "x", ((3, 3, 3, 1), (3, 3, 3, 1)), (i, slice(None, None, None))) assert bd1 == bd3 assert a == c
def test_slicing_chunks(): result, chunks = slice_array("y", "x", ([5, 5], [5, 5]), (1, np.array([2, 0, 3]))) assert chunks == ((3,),) result, chunks = slice_array( "y", "x", ([5, 5], [5, 5]), (slice(0, 7), np.array([2, 0, 3])) ) assert chunks == ((5, 2), (3,)) result, chunks = slice_array("y", "x", ([5, 5], [5, 5]), (slice(0, 7), 1)) assert chunks == ((5, 2),)
def test_slice_optimizations(): # bar[:] expected = {("foo", 0): ("bar", 0)} result, chunks = slice_array("foo", "bar", [[100]], (slice(None, None, None),)) assert expected == result # bar[:,:,:] expected = {("foo", 0): ("bar", 0), ("foo", 1): ("bar", 1), ("foo", 2): ("bar", 2)} result, chunks = slice_array( "foo", "bar", [(100, 1000, 10000)], (slice(None, None, None), slice(None, None, None), slice(None, None, None)) ) assert expected == result
def test_slicing_blockdims(): result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (1, [2, 0, 3])) assert blockdims == ((3,),) result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), [2, 0, 3])) assert blockdims == ((5, 2), (3,)) result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), 1)) assert blockdims == ((5, 2),)
def test_slice_optimizations(): #bar[:] expected = {'foo':'bar'} result, chunks = slice_array('foo', 'bar', [[100]], (slice(None,None,None),)) assert expected == result #bar[:,:,:] expected = {'foo':'bar'} result, chunks = slice_array('foo', 'bar', [(100,1000,10000)], (slice(None,None,None),slice(None,None,None), slice(None,None,None))) assert expected == result
def test_slicing_chunks(): result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (1, np.array([2, 0, 3]))) assert chunks == ((3,), ) result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), np.array([2, 0, 3]))) assert chunks == ((5, 2), (3, )) result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 7), 1)) assert chunks == ((5, 2), )
def test_slice_optimizations(): #bar[:] expected = {'foo': 'bar'} result, chunks = slice_array('foo', 'bar', [[100]], (slice(None, None, None), )) assert expected == result #bar[:,:,:] expected = {'foo': 'bar'} result, chunks = slice_array('foo', 'bar', [(100, 1000, 10000)], (slice( None, None, None), slice(None, None, None), slice(None, None, None))) assert expected == result
def test_slice_optimizations(): # bar[:] expected = {("foo", 0): ("bar", 0)} result, chunks = slice_array("foo", "bar", [[100]], (slice(None, None, None),)) assert expected == result # bar[:,:,:] expected = {("foo", 0): ("bar", 0), ("foo", 1): ("bar", 1), ("foo", 2): ("bar", 2)} result, chunks = slice_array( "foo", "bar", [(100, 1000, 10000)], (slice(None, None, None), slice(None, None, None), slice(None, None, None)), ) assert expected == result
def test_slicing_with_numpy_arrays(): a, bd1 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), ([1, 2, 9], slice(None, None, None))) b, bd2 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([1, 2, 9]), slice(None, None, None))) assert bd1 == bd2 assert a == b i = [False, True, True, False, False, False, False, False, False, True, False] c, bd3 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), (i, slice(None, None, None))) assert bd1 == bd3 assert a == c
def test_slice_lists(): y, chunks = slice_array("y", "x", ((3, 3, 3, 1), (3, 3, 3, 1)), ([2, 1, 9], slice(None, None, None))) assert y == dict( ( ("y", 0, i), ( getitem, ( np.concatenate, ( list, [ (getitem, ("x", 0, i), ([1, 2], slice(None, None, None))), (getitem, ("x", 3, i), ([0], slice(None, None, None))), ], ), 0, ), ([1, 0, 2], slice(None, None, None)), ), ) for i in range(4) ) assert chunks == ((3,), (3, 3, 3, 1))
def test_slicing_with_singleton_indices(): result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 5), 8)) expected = {('y', 0): (getitem, ('x', 0, 1), (slice(None, None, None), 3))} assert expected == result
def test_slicing_with_numpy_arrays(): a, bd1 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([1, 2, 9]), slice(None, None, None))) b, bd2 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([1, 2, 9]), slice(None, None, None))) assert bd1 == bd2 np.testing.assert_equal(a, b) i = [False, True, True, False, False, False, False, False, False, True, False] index = (i, slice(None, None, None)) index = normalize_index(index, (10, 10)) c, bd3 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), index) assert bd1 == bd3 np.testing.assert_equal(a, c)
def test_slicing_with_singleton_indices(): result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 5), 8)) expected = {('y', 0): (getitem, ('x', 0, 1), (slice(None, None, None), 3))} assert expected == result
def test_slicing_with_numpy_arrays(): a, bd1 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), ([1, 2, 9], slice(None, None, None))) b, bd2 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([1, 2, 9]), slice(None, None, None))) assert bd1 == bd2 np.testing.assert_equal(a, b) i = [ False, True, True, False, False, False, False, False, False, True, False ] c, bd3 = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), (i, slice(None, None, None))) assert bd1 == bd3 np.testing.assert_equal(a, c)
def test_slicing_with_singleton_indices(): result, chunks = slice_array( "y", "x", ([5, 5], [5, 5]), (slice(0, 5), 8), itemsize=8 ) expected = {("y", 0): (getitem, ("x", 0, 1), (slice(None, None, None), 3))} assert expected == result
def test_slice_array_1d(): # x[24::2] expected = { ("y", 0): (getitem, ("x", 0), (slice(24, 25, 2), )), ("y", 1): (getitem, ("x", 1), (slice(1, 25, 2), )), ("y", 2): (getitem, ("x", 2), (slice(0, 25, 2), )), ("y", 3): (getitem, ("x", 3), (slice(1, 25, 2), )), } result, chunks = slice_array("y", "x", [[25] * 4], [slice(24, None, 2)], 8) assert expected == result # x[26::2] expected = { ("y", 0): (getitem, ("x", 1), (slice(1, 25, 2), )), ("y", 1): (getitem, ("x", 2), (slice(0, 25, 2), )), ("y", 2): (getitem, ("x", 3), (slice(1, 25, 2), )), } result, chunks = slice_array("y", "x", [[25] * 4], [slice(26, None, 2)], 8) assert expected == result # x[24::2] expected = { ("y", 0): (getitem, ("x", 0), (slice(24, 25, 2), )), ("y", 1): (getitem, ("x", 1), (slice(1, 25, 2), )), ("y", 2): (getitem, ("x", 2), (slice(0, 25, 2), )), ("y", 3): (getitem, ("x", 3), (slice(1, 25, 2), )), } result, chunks = slice_array("y", "x", [(25, ) * 4], (slice(24, None, 2), ), 8) assert expected == result # x[26::2] expected = { ("y", 0): (getitem, ("x", 1), (slice(1, 25, 2), )), ("y", 1): (getitem, ("x", 2), (slice(0, 25, 2), )), ("y", 2): (getitem, ("x", 3), (slice(1, 25, 2), )), } result, chunks = slice_array("y", "x", [(25, ) * 4], (slice(26, None, 2), ), 8) assert expected == result
def test_slice_lists(): y, chunks = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), ([2, 1, 9], slice(None, None, None))) exp = {('y', 0, i): (getitem, (np.concatenate, [ (getitem, ('x', 0, i), ([1, 2], slice(None, None, None))), (getitem, ('x', 3, i), ([0], slice(None, None, None))) ], 0), ([1, 0, 2], slice(None, None, None))) for i in range(4)} np.testing.assert_equal(y, exp) assert chunks == ((3, ), (3, 3, 3, 1))
def test_slicing_with_newaxis(): result, chunks = slice_array("y", "x", ([5, 5], [5, 5]), (slice(0, 3), None, slice(None, None, None))) expected = { ("y", 0, 0, 0): (getitem, ("x", 0, 0), (slice(0, 3, 1), None, slice(None, None, None))), ("y", 0, 0, 1): (getitem, ("x", 0, 1), (slice(0, 3, 1), None, slice(None, None, None))), } assert expected == result assert chunks == ((3,), (1,), (5, 5))
def test_uneven_blockdims(): blockdims = ((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30), (100,)) index = (slice(240, 270), slice(None)) dsk_out, bd_out = slice_array('in', 'out', blockdims, index) sol = {('in', 0, 0): (getitem, ('out', 7, 0), (slice(28, 31, 1), slice(None))), ('in', 1, 0): (getitem, ('out', 8, 0), (slice(0, 27, 1), slice(None)))} assert dsk_out == sol assert bd_out == ((3, 27), (100,)) blockdims = ((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30),) * 2 index = (slice(240, 270), slice(180, 230)) dsk_out, bd_out = slice_array('in', 'out', blockdims, index) sol = {('in', 0, 0): (getitem, ('out', 7, 5), (slice(28, 31, 1), slice(29, 30, 1))), ('in', 0, 1): (getitem, ('out', 7, 6), (slice(28, 31, 1), slice(None))), ('in', 0, 2): (getitem, ('out', 7, 7), (slice(28, 31, 1), slice(0, 18, 1))), ('in', 1, 0): (getitem, ('out', 8, 5), (slice(0, 27, 1), slice(29, 30, 1))), ('in', 1, 1): (getitem, ('out', 8, 6), (slice(0, 27, 1), slice(None))), ('in', 1, 2): (getitem, ('out', 8, 7), (slice(0, 27, 1), slice(0, 18, 1)))} assert dsk_out == sol assert bd_out == ((3, 27), (1, 31, 18))
def test_slice_lists(): y, chunks = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), (np.array([2, 1, 9]), slice(None, None, None))) exp = {('y', 0, i): (getitem, (np.concatenate, [(getitem, ('x', 0, i), ([1, 2], slice(None, None, None))), (getitem, ('x', 3, i), ([0], slice(None, None, None)))], 0), ([1, 0, 2], slice(None, None, None))) for i in range(4)} np.testing.assert_equal(y, exp) assert chunks == ((3,), (3, 3, 3, 1))
def test_slicing_with_newaxis(): result, chunks = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 3), None, slice(None, None, None))) expected = { ('y', 0, 0, 0): (getitem, ('x', 0, 0), (slice(0, 3, 1), None, slice(None, None, None))), ('y', 0, 0, 1): (getitem, ('x', 0, 1), (slice(0, 3, 1), None, slice(None, None, None)))} assert expected == result assert chunks == ((3,), (1,), (5, 5))
def test_slice_lists(): y, chunks = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), ([2, 1, 9], slice(None, None, None))) exp = dict( (('y', 0, i), (getitem, (np.concatenate, (list, [(getitem, ('x', 0, i), ([1, 2], slice(None, None, None)) ), (getitem, ('x', 3, i), ([0], slice(None, None, None)))]), 0), ([1, 0, 2], slice(None, None, None)))) for i in range(4)) assert y == exp assert chunks == ((3, ), (3, 3, 3, 1))
def test_slice_array_2d(): # 2d slices: x[13::2,10::1] expected = { ("y", 0, 0): (getitem, ("x", 0, 0), (slice(13, 20, 2), slice(10, 20, 1))), ("y", 0, 1): ( getitem, ("x", 0, 1), (slice(13, 20, 2), slice(None, None, None)), ), ("y", 0, 2): ( getitem, ("x", 0, 2), (slice(13, 20, 2), slice(None, None, None)), ), } result, chunks = slice_array( "y", "x", [[20], [20, 20, 5]], [slice(13, None, 2), slice(10, None, 1)], itemsize=8, ) assert expected == result # 2d slices with one dimension: x[5,10::1] expected = { ("y", 0): (getitem, ("x", 0, 0), (5, slice(10, 20, 1))), ("y", 1): (getitem, ("x", 0, 1), (5, slice(None, None, None))), ("y", 2): (getitem, ("x", 0, 2), (5, slice(None, None, None))), } result, chunks = slice_array( "y", "x", ([20], [20, 20, 5]), [5, slice(10, None, 1)], 8 ) assert expected == result
def test_slice_lists(): y, chunks = slice_array('y', 'x', ((3, 3, 3, 1), (3, 3, 3, 1)), ([2, 1, 9], slice(None, None, None))) exp = dict( (('y', 0, i), (getitem, (np.concatenate, (list, [(getitem, ('x', 0, i), ([1, 2], slice(None, None, None))), (getitem, ('x', 3, i), ([0], slice(None, None, None)))]), 0), ([1, 0, 2], slice(None, None, None)))) for i in range(4)) assert y == exp assert chunks == ((3,), (3, 3, 3, 1))
def test_slicing_with_newaxis(): result, blockdims = slice_array('y', 'x', ([5, 5], [5, 5]), (slice(0, 3), None, slice(None, None, None))) expected = { ('y', 0, 0, 0): (getitem, ('x', 0, 0), (slice(0, 3, 1), None, slice(None, None, None))), ('y', 0, 0, 1): (getitem, ('x', 0, 1), (slice(0, 3, 1), None, slice(None, None, None))) } assert expected == result assert blockdims == ((3,), (1,), (5, 5))
def test_slicing_with_newaxis(): result, chunks = slice_array( "y", "x", ([5, 5], [5, 5]), (slice(0, 3), None, slice(None, None, None)), itemsize=8, ) expected = { ("y", 0, 0, 0): ( getitem, ("x", 0, 0), (slice(0, 3, 1), None, slice(None, None, None)), ), ("y", 0, 0, 1): ( getitem, ("x", 0, 1), (slice(0, 3, 1), None, slice(None, None, None)), ), } assert expected == result assert chunks == ((3,), (1,), (5, 5))