|
13 | 13 | from cubed._testing import assert_array_equal |
14 | 14 | from cubed.array_api.dtypes import _floating_dtypes |
15 | 15 | from cubed.backend_array_api import namespace as nxp |
16 | | -from cubed.core.ops import general_blockwise, merge_chunks, partial_reduce, tree_reduce |
| 16 | +from cubed.core.ops import ( |
| 17 | + _store_array, |
| 18 | + general_blockwise, |
| 19 | + merge_chunks, |
| 20 | + partial_reduce, |
| 21 | + tree_reduce, |
| 22 | +) |
17 | 23 | from cubed.core.optimization import fuse_all_optimize_dag, multiple_inputs_optimize_dag |
18 | 24 | from cubed.core.plan import ArrayRole |
19 | 25 | from cubed.storage.store import open_storage_array |
@@ -197,6 +203,11 @@ def test_to_zarr_region(tmp_path, spec, executor): |
197 | 203 | # note that the same zarr store is overwritten in the following tests |
198 | 204 |
|
199 | 205 | region = (slice(0, 2), slice(0, 2)) |
| 206 | + |
| 207 | + # need to use internal _store_array function to access plan |
| 208 | + # since to_zarr is eager |
| 209 | + assert _store_array(a[:2, :2], z, region=region).plan().num_tasks == 1 |
| 210 | + |
200 | 211 | cubed.to_zarr(a[:2, :2], z, region=region, executor=executor) |
201 | 212 | res = open_storage_array(store, mode="r") |
202 | 213 | assert_array_equal(res[region], np.array([[1, 2], [5, 6]])) |
|
0 commit comments