Skip to content

Commit 3cfface

Browse files
committed
add literacy to test
1 parent 3db2e22 commit 3cfface

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/test_array.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,30 @@ def test_array_create_order(
445445
def test_write_empty_chunks(
446446
zarr_format: ZarrFormat, store: MemoryStore, write_empty_chunks: bool, fill_value: int
447447
) -> None:
448+
"""
449+
Check that the write_empty_chunks value of the config is applied correctly. We expect that
450+
when write_empty_chunks is True, writing chunks equal to the fill value will result in
451+
those chunks appearing in the store.
452+
453+
When write_empty_chunks is False, writing chunks that are equal to the fill value will result in
454+
those chunks not being present in the store. In particular, they should be deleted if they were
455+
already present.
456+
"""
448457
arr = Array.create(
449-
store=store, shape=(1,), zarr_format=zarr_format, dtype="i4", fill_value=fill_value
458+
store=store,
459+
shape=(2,),
460+
zarr_format=zarr_format,
461+
dtype="i4",
462+
fill_value=fill_value,
463+
chunk_shape=(1,),
450464
)
451465

466+
# initialize the store with some non-fill value chunks
467+
arr[:] = fill_value + 1
468+
assert arr.nchunks_initialized == arr.nchunks
469+
452470
with config.set({"array.write_empty_chunks": write_empty_chunks}):
453471
arr[:] = fill_value
454-
455472
if not write_empty_chunks:
456473
assert arr.nchunks_initialized == 0
457474
else:

0 commit comments

Comments
 (0)