MCPcopy Create free account
hub / github.com/dask/dask / test_from_array_getitem

Function test_from_array_getitem

dask/array/tests/test_array_core.py:2975–2990  ·  view source on GitHub ↗
(wrap, inline_array)

Source from the content-addressed store, hash-verified

2973@pytest.mark.parametrize("wrap", [True, False])
2974@pytest.mark.parametrize("inline_array", [True, False])
2975def test_from_array_getitem(wrap, inline_array):
2976 x = np.arange(10)
2977 called = False
2978
2979 def my_getitem(a, ind):
2980 nonlocal called
2981 called = True
2982 return a[ind]
2983
2984 xx = MyArray(x) if wrap else x
2985 y = da.from_array(xx, chunks=(5,), getitem=my_getitem, inline_array=inline_array)
2986
2987 assert_eq(x, y)
2988 # If we have a raw numpy array we eagerly slice, so custom getters
2989 # are not called.
2990 assert called is wrap
2991
2992
2993def test_from_array_minus_one():

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
MyArrayClass · 0.85
arangeMethod · 0.45

Tested by

no test coverage detected