Skip to content

Commit ea99951

Browse files
committed
add "other" dtype test
1 parent 19ec879 commit ea99951

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_v2.py

+19
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,22 @@ def test_structured_dtype_roundtrip(fill_value, tmp_path) -> None:
313313
za[...] = a
314314
za = zarr.open_array(store=array_path)
315315
assert (a == za[:]).all()
316+
317+
318+
@pytest.mark.parametrize("fill_value", [None, b"x"], ids=["no_fill", "fill"])
319+
def test_other_dtype_roundtrip(fill_value, tmp_path) -> None:
320+
a = np.array([b"a\0\0", b"bb", b"ccc"], dtype="V7")
321+
array_path = tmp_path / "data.zarr"
322+
za = zarr.create(
323+
shape=(3,),
324+
store=array_path,
325+
chunks=(2,),
326+
fill_value=fill_value,
327+
zarr_format=2,
328+
dtype=a.dtype,
329+
)
330+
if fill_value is not None:
331+
assert (np.array([fill_value] * a.shape[0], dtype=a.dtype) == za[:]).all()
332+
za[...] = a
333+
za = zarr.open_array(store=array_path)
334+
assert (a == za[:]).all()

0 commit comments

Comments
 (0)