| 2973 | @pytest.mark.parametrize("wrap", [True, False]) |
| 2974 | @pytest.mark.parametrize("inline_array", [True, False]) |
| 2975 | def 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 | |
| 2993 | def test_from_array_minus_one(): |