MCPcopy
hub / github.com/dask/dask / test_from_array_getitem_fused

Function test_from_array_getitem_fused

dask/array/tests/test_creation.py:1056–1069  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1054
1055
1056def test_from_array_getitem_fused():
1057 arr = np.arange(100).reshape(10, 10)
1058 darr = da.from_array(arr, chunks=(5, 5))
1059 result = darr[slice(1, 5), :][slice(1, 3), :]
1060 dsk = collections_to_expr([result]).__dask_graph__()
1061 # Ensure that slices are merged properly
1062 key = [k for k in dsk if "array-getitem" in k[0]][0]
1063 key_2 = [
1064 k
1065 for k, v in dsk[key].args[0].items()
1066 if "getitem" in k[0] and not isinstance(v, Alias)
1067 ][0]
1068 assert dsk[key].args[0][key_2].args[1] == ((slice(2, 4), slice(0, None)))
1069 assert_eq(result, arr[slice(1, 5), :][slice(1, 3), :])
1070
1071
1072@pytest.mark.parametrize("shape_chunks", [((50, 4), (10, 2)), ((50,), (10,))])

Callers

nothing calls this directly

Calls 6

collections_to_exprFunction · 0.90
assert_eqFunction · 0.90
reshapeMethod · 0.80
arangeMethod · 0.45
__dask_graph__Method · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…