|
5 | 5 | import zarr
|
6 | 6 | from zarr import Array, Group
|
7 | 7 | from zarr.abc.store import Store
|
8 |
| -from zarr.api.synchronous import load, open, open_group, save, save_array, save_group |
| 8 | +from zarr.api.synchronous import create, load, open, open_group, save, save_array, save_group |
| 9 | + |
| 10 | + |
| 11 | +def test_create_array(memory_store: Store) -> None: |
| 12 | + store = memory_store |
| 13 | + |
| 14 | + # create array |
| 15 | + z = create(shape=100, store=store) |
| 16 | + assert isinstance(z, Array) |
| 17 | + assert z.shape == (100,) |
| 18 | + |
| 19 | + # create array, overwrite, specify chunk shape |
| 20 | + z = create(shape=200, chunk_shape=20, store=store, overwrite=True) |
| 21 | + assert isinstance(z, Array) |
| 22 | + assert z.shape == (200,) |
| 23 | + assert z.chunks == (20,) |
| 24 | + |
| 25 | + # create array, overwrite, specify chunk shape via chunks param |
| 26 | + z = create(shape=400, chunks=40, store=store, overwrite=True) |
| 27 | + assert isinstance(z, Array) |
| 28 | + assert z.shape == (400,) |
| 29 | + assert z.chunks == (40,) |
9 | 30 |
|
10 | 31 |
|
11 | 32 | def test_open_array(memory_store: Store) -> None:
|
|
0 commit comments