Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/test_array_stateful.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
DTYPE = np.dtype("int16")
METADATA_KEYS = (".zarray", ".zattrs", "zarr.json")
MAX_SIDE = 6
# `append` may grow an axis past `MAX_SIDE`, but not without bound: with chunks of 1,
# the cells an extent of 100 steps could reach make each full-array read take seconds,
# and the nightly run of every example together exceeded pytest's faulthandler_timeout.
MAX_APPEND_EXTENT = 2 * MAX_SIDE


async def _list(store: MemoryStore, prefix: str) -> list[str]:
Expand Down Expand Up @@ -210,7 +214,8 @@ def append(self, data: st.DataObject) -> None:
axes = st.sampled_from(self.legacy_axes) | axes
axis = data.draw(axes, label="axis")
block_shape = list(self.shape)
block_shape[axis] = data.draw(st.integers(0, 4), label="rows")
max_rows = min(4, max(0, MAX_APPEND_EXTENT - self.shape[axis]))
block_shape[axis] = data.draw(st.integers(0, max_rows), label="rows")
block = data.draw(npst.arrays(DTYPE, tuple(block_shape)), label="block")
note(f"append {block.shape} along {axis} to {self.shape}")
if self.shape[axis] == 0 and block.shape[axis]:
Expand Down
Loading