Skip to content

Commit 9855060

Browse files
d-v-bclaude
andcommitted
test: rename test_sync_codec_pipeline -> test_chunk_transform; drop cross-file dup
The file named test_sync_codec_pipeline.py tested no pipeline -- it is the unit test suite for ChunkTransform (the per-chunk synchronous codec chain that FusedCodecPipeline uses internally). "sync codec pipeline" was an earlier name for the Fused pipeline; the filename had outlived it. Renamed to test_chunk_transform.py (git mv preserves history) and added a module docstring naming what it actually covers. Also removed test_sync_transform_encode_decode_roundtrip from test_fused_pipeline.py: it was a weaker cross-file duplicate of this file's test_encode_decode_roundtrip (which covers the same encode->decode->compare over five codec chains rather than just bytes-only). Its one extra assertion -- that evolve_from_array_spec populates _sync_transform -- is already covered by test_evolve_from_array_spec in the Fused file. test_codec_pipeline.py left as-is: all three tests are correctly placed and cover things the Scenario suite can't (the low-level pipeline.read GetResult API, a plain dict store, and the zarr-developers#3937 cast_value dtype-threading regression). Co-Authored-By: Claude Opus 4.8 <[email protected]>
1 parent 35255fa commit 9855060

2 files changed

Lines changed: 10 additions & 30 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
"""Unit tests for ChunkTransform -- the per-chunk synchronous codec chain.
2+
3+
ChunkTransform is the data structure FusedCodecPipeline uses to encode/decode a
4+
single chunk through a sequence of codecs synchronously. These tests exercise it
5+
directly (no pipeline, no store): construction and its rejection of codecs that
6+
lack a synchronous implementation, encode/decode roundtrips across codec chains,
7+
compute_encoded_size, and None short-circuiting when an array->array codec
8+
returns None. End-to-end pipeline behavior lives in the pipeline test modules.
9+
"""
10+
111
from __future__ import annotations
212

313
from typing import Any

‎tests/test_fused_pipeline.py‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -194,36 +194,6 @@ def test_sync_write_async_read_roundtrip() -> None:
194194
)
195195

196196

197-
def test_sync_transform_encode_decode_roundtrip() -> None:
198-
"""Sync transform can encode and decode a chunk."""
199-
from zarr.core.array_spec import ArrayConfig, ArraySpec
200-
from zarr.core.buffer import default_buffer_prototype
201-
from zarr.core.dtype import Float64
202-
203-
codecs = (BytesCodec(),)
204-
pipeline = FusedCodecPipeline.from_codecs(codecs)
205-
zdtype = Float64()
206-
spec = ArraySpec(
207-
shape=(100,),
208-
dtype=zdtype,
209-
fill_value=zdtype.cast_scalar(0.0),
210-
prototype=default_buffer_prototype(),
211-
config=ArrayConfig(order="C", write_empty_chunks=True),
212-
)
213-
pipeline = pipeline.evolve_from_array_spec(spec)
214-
assert pipeline._sync_transform is not None
215-
216-
# Encode
217-
proto = default_buffer_prototype()
218-
data = proto.nd_buffer.from_numpy_array(np.arange(100, dtype="float64"))
219-
encoded = pipeline._sync_transform.encode_chunk(data, spec)
220-
assert encoded is not None
221-
222-
# Decode
223-
decoded = pipeline._sync_transform.decode_chunk(encoded, spec)
224-
np.testing.assert_array_equal(decoded.as_numpy_array(), np.arange(100, dtype="float64"))
225-
226-
227197
def test_partial_shard_write_uses_set_range() -> None:
228198
"""Partial shard writes with fixed-size codecs should use set_range_sync.
229199

0 commit comments

Comments
 (0)