|
202 | 202 | ]
|
203 | 203 |
|
204 | 204 | # Define zarr v3 codec configurations with proper bytes codec
|
205 |
| -ZARR_V3_LZ4_CODECS = [ |
206 |
| - {"name": "bytes", "configuration": {}}, |
207 |
| - {"name": "blosc", "configuration": {"cname": "lz4"}} |
208 |
| -] |
| 205 | +ZARR_V3_LZ4_CODECS = [{"name": "bytes", "configuration": {}}, {"name": "blosc", "configuration": {"cname": "lz4"}}] |
209 | 206 |
|
210 |
| -ZARR_V3_PICKLE_CODECS = [ |
211 |
| - {"name": "bytes", "configuration": {}}, |
212 |
| - {"name": "pickle", "configuration": {}} |
213 |
| -] |
| 207 | +ZARR_V3_PICKLE_CODECS = [{"name": "bytes", "configuration": {}}, {"name": "pickle", "configuration": {}}] |
214 | 208 |
|
215 |
| -ZARR_V3_LZMA_CODECS = [ |
216 |
| - {"name": "bytes", "configuration": {}}, |
217 |
| - {"name": "lzma", "configuration": {}} |
218 |
| -] |
| 209 | +ZARR_V3_LZMA_CODECS = [{"name": "bytes", "configuration": {}}, {"name": "lzma", "configuration": {}}] |
219 | 210 |
|
220 | 211 | # test for LZ4 compressor (zarr v2) or codecs (zarr v3)
|
221 | 212 | TEST_CASE_13_COMPRESSOR_LZ4 = [
|
222 |
| - dict(merged_shape=TENSOR_4x4.shape, compressor="LZ4") if not version_geq(get_package_version("zarr"), "3.0.0") |
223 |
| - else dict(merged_shape=TENSOR_4x4.shape, codecs=ZARR_V3_LZ4_CODECS), |
| 213 | + ( |
| 214 | + dict(merged_shape=TENSOR_4x4.shape, compressor="LZ4") |
| 215 | + if not version_geq(get_package_version("zarr"), "3.0.0") |
| 216 | + else dict(merged_shape=TENSOR_4x4.shape, codecs=ZARR_V3_LZ4_CODECS) |
| 217 | + ), |
224 | 218 | [
|
225 | 219 | (TENSOR_4x4[..., :2, :2], (0, 0)),
|
226 | 220 | (TENSOR_4x4[..., :2, 2:], (0, 2)),
|
|
232 | 226 |
|
233 | 227 | # test for pickle compressor (zarr v2) or codecs (zarr v3)
|
234 | 228 | TEST_CASE_14_COMPRESSOR_PICKLE = [
|
235 |
| - dict(merged_shape=TENSOR_4x4.shape, compressor="Pickle") if not version_geq(get_package_version("zarr"), "3.0.0") |
236 |
| - else dict(merged_shape=TENSOR_4x4.shape, codecs=ZARR_V3_PICKLE_CODECS), |
| 229 | + ( |
| 230 | + dict(merged_shape=TENSOR_4x4.shape, compressor="Pickle") |
| 231 | + if not version_geq(get_package_version("zarr"), "3.0.0") |
| 232 | + else dict(merged_shape=TENSOR_4x4.shape, codecs=ZARR_V3_PICKLE_CODECS) |
| 233 | + ), |
237 | 234 | [
|
238 | 235 | (TENSOR_4x4[..., :2, :2], (0, 0)),
|
239 | 236 | (TENSOR_4x4[..., :2, 2:], (0, 2)),
|
|
245 | 242 |
|
246 | 243 | # test for LZMA compressor (zarr v2) or codecs (zarr v3)
|
247 | 244 | TEST_CASE_15_COMPRESSOR_LZMA = [
|
248 |
| - dict(merged_shape=TENSOR_4x4.shape, compressor="LZMA") if not version_geq(get_package_version("zarr"), "3.0.0") |
249 |
| - else dict(merged_shape=TENSOR_4x4.shape, codecs=ZARR_V3_LZMA_CODECS), |
| 245 | + ( |
| 246 | + dict(merged_shape=TENSOR_4x4.shape, compressor="LZMA") |
| 247 | + if not version_geq(get_package_version("zarr"), "3.0.0") |
| 248 | + else dict(merged_shape=TENSOR_4x4.shape, codecs=ZARR_V3_LZMA_CODECS) |
| 249 | + ), |
250 | 250 | [
|
251 | 251 | (TENSOR_4x4[..., :2, :2], (0, 0)),
|
252 | 252 | (TENSOR_4x4[..., :2, 2:], (0, 2)),
|
|
294 | 294 |
|
295 | 295 | # test with value_codecs for zarr v3
|
296 | 296 | TEST_CASE_19_VALUE_CODECS = [
|
297 |
| - dict(merged_shape=TENSOR_4x4.shape, value_codecs=[ |
298 |
| - {"name": "bytes", "configuration": {}}, |
299 |
| - {"name": "blosc", "configuration": {"cname": "zstd"}} |
300 |
| - ]), |
| 297 | + dict( |
| 298 | + merged_shape=TENSOR_4x4.shape, |
| 299 | + value_codecs=[{"name": "bytes", "configuration": {}}, {"name": "blosc", "configuration": {"cname": "zstd"}}], |
| 300 | + ), |
301 | 301 | [
|
302 | 302 | (TENSOR_4x4[..., :2, :2], (0, 0)),
|
303 | 303 | (TENSOR_4x4[..., :2, 2:], (0, 2)),
|
|
309 | 309 |
|
310 | 310 | # test with count_codecs for zarr v3
|
311 | 311 | TEST_CASE_20_COUNT_CODECS = [
|
312 |
| - dict(merged_shape=TENSOR_4x4.shape, count_codecs=[ |
313 |
| - {"name": "bytes", "configuration": {}}, |
314 |
| - {"name": "blosc", "configuration": {"cname": "zlib"}} |
315 |
| - ]), |
| 312 | + dict( |
| 313 | + merged_shape=TENSOR_4x4.shape, |
| 314 | + count_codecs=[{"name": "bytes", "configuration": {}}, {"name": "blosc", "configuration": {"cname": "zlib"}}], |
| 315 | + ), |
316 | 316 | [
|
317 | 317 | (TENSOR_4x4[..., :2, :2], (0, 0)),
|
318 | 318 | (TENSOR_4x4[..., :2, 2:], (0, 2)),
|
|
0 commit comments