|
8 | 8 |
|
9 | 9 | import zarr.codecs
|
10 | 10 | from zarr.core import Array
|
11 |
| -from zarr.creation import array, empty, full, ones, zeros |
| 11 | +from zarr.creation import array, empty, full, ones, open_array, zeros |
12 | 12 | from zarr.hierarchy import open_group
|
13 | 13 | from zarr.storage import DirectoryStore, MemoryStore, Store, ZipStore
|
14 | 14 |
|
@@ -148,6 +148,23 @@ def test_array(tmp_path, module, compressor, store_type):
|
148 | 148 | assert z.dtype == z2.dtype
|
149 | 149 | xp.testing.assert_array_equal(z[:], z2[:])
|
150 | 150 |
|
| 151 | + store = init_store(tmp_path / "open_array", store_type) |
| 152 | + a = xp.arange(100) |
| 153 | + z = open_array( |
| 154 | + store, |
| 155 | + shape=a.shape, |
| 156 | + dtype=a.dtype, |
| 157 | + chunks=10, |
| 158 | + compressor=compressor, |
| 159 | + meta_array=xp.empty(()) |
| 160 | + ) |
| 161 | + z[:] = a |
| 162 | + assert a.shape == z.shape |
| 163 | + assert a.dtype == z.dtype |
| 164 | + assert isinstance(a, type(z[:])) |
| 165 | + assert isinstance(z.meta_array, type(xp.empty(()))) |
| 166 | + xp.testing.assert_array_equal(a, z[:]) |
| 167 | + |
151 | 168 |
|
152 | 169 | @pytest.mark.parametrize("module, compressor", param_module_and_compressor)
|
153 | 170 | def test_empty(module, compressor):
|
|
0 commit comments