Skip to content

Commit f78e115

Browse files
d-v-bclaude
andcommitted
test: expect the lifecycle machine's upgrade warning only on non-empty axes
Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a903d66 commit f78e115

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎tests/test_array_stateful.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ def _open(self) -> zarr.Array[Any]:
167167
with warnings.catch_warnings(record=True) as record:
168168
warnings.simplefilter("always", ZarrUserWarning)
169169
arr = zarr.open_array(self.store, path=self.path, mode="r+")
170+
# A stored chunk size of 0 is read silently on an empty axis; on a non-empty one
171+
# it warns that the axis holds only the fill value. Either way it is upgraded.
170172
warned = any(issubclass(w.category, ZarrUserWarning) for w in record)
171-
assert warned is bool(self.legacy_axes), [str(w.message) for w in record]
173+
must_warn = any(self.shape[axis] > 0 for axis in self.legacy_axes)
174+
assert warned is must_warn, [str(w.message) for w in record]
175+
assert arr.metadata._stored_document_upgraded is bool(self.legacy_axes)
172176
return arr
173177

174178
# ----------------------------------------------------------------- model

0 commit comments

Comments
 (0)