| 3091 | @pytest.mark.parametrize("asarray", [da.asarray, da.asanyarray]) |
| 3092 | @pytest.mark.parametrize("inline_array", [True, False]) |
| 3093 | def test_asarray_h5py(asarray, inline_array): |
| 3094 | h5py = pytest.importorskip("h5py") |
| 3095 | |
| 3096 | with tmpfile(".hdf5") as fn: |
| 3097 | with h5py.File(fn, mode="a") as f: |
| 3098 | d = f.create_dataset("/x", shape=(2, 2), dtype=float) |
| 3099 | x = asarray(d, inline_array=inline_array) |
| 3100 | |
| 3101 | # Check for the array in the dsk |
| 3102 | dsk = dict(x.dask) |
| 3103 | assert (d in dsk.values()) is not inline_array |
| 3104 | assert not any(isinstance(v, np.ndarray) for v in dsk.values()) |
| 3105 | |
| 3106 | |
| 3107 | def test_asarray_chunks(): |