Skip to content

Commit 0d9c38e

Browse files
d-v-bclaude
andcommitted
test(codecs): cross-product blosc JSON roundtrip over cname x shuffle
Stacked parametrize over BLOSC_CNAME and BLOSC_SHUFFLE so the JSON roundtrip exercises every (cname, shuffle) pair (18 cases instead of 9 in a disjoint union). Drops the **kwargs/dict[str, Any] indirection the disjoint form needed, since the cross-product form passes typed arguments directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6551a91 commit 0d9c38e

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

tests/test_codecs/test_blosc.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,29 +181,19 @@ def test_blosc_codec_accepts_all_shuffles(shuffle: BloscShuffleLiteral) -> None:
181181
assert codec.shuffle == shuffle
182182

183183

184-
@pytest.mark.parametrize(
185-
("param", "value"),
186-
[("cname", v) for v in BLOSC_CNAME] + [("shuffle", v) for v in BLOSC_SHUFFLE],
187-
)
188-
def test_blosc_codec_json_roundtrip(param: str, value: str) -> None:
184+
@pytest.mark.parametrize("shuffle", BLOSC_SHUFFLE)
185+
@pytest.mark.parametrize("cname", BLOSC_CNAME)
186+
def test_blosc_codec_json_roundtrip(cname: BloscCnameLiteral, shuffle: BloscShuffleLiteral) -> None:
189187
"""
190-
JSON serialization (to_dict / from_dict) preserves every value in
191-
BLOSC_CNAME and BLOSC_SHUFFLE. Guards against drift in the codec's V3
192-
JSON form for any compressor or shuffle option.
188+
JSON serialization (to_dict / from_dict) preserves every (cname, shuffle)
189+
pair drawn from BLOSC_CNAME x BLOSC_SHUFFLE. Guards against drift in the
190+
codec's V3 JSON form for any combination of compressor and shuffle option.
193191
194192
The non-varied fields are fully specified so the codec has no tunable
195193
attributes; tunability is not part of the JSON form and would otherwise
196194
cause spurious round-trip mismatches.
197195
"""
198-
kwargs: dict[str, Any] = {
199-
"typesize": 1,
200-
"cname": "zstd",
201-
"clevel": 5,
202-
"shuffle": "shuffle",
203-
"blocksize": 0,
204-
param: value,
205-
}
206-
codec = BloscCodec(**kwargs)
196+
codec = BloscCodec(typesize=1, cname=cname, clevel=5, shuffle=shuffle, blocksize=0)
207197
restored = BloscCodec.from_dict(codec.to_dict())
208198
assert restored == codec
209199

0 commit comments

Comments
 (0)