11"""Tests the schema v1 dataset_serializer public API."""
22
3+ from pathlib import Path
4+
35import pytest
46from dask import array as dask_array
57from numpy import array as np_array
3840from .helpers import output_path
3941
4042try :
41- from zfpy import ZFPY as zfpy_ZFPY # noqa: N811
43+ from zfpy import ZFPY
4244
4345 HAS_ZFPY = True
4446except ImportError :
45- zfpy_ZFPY = None # noqa: N816
47+ ZFPY = None
4648 HAS_ZFPY = False
4749
4850from numcodecs import Blosc as nc_Blosc
4951
50- from mdio .schemas .compressors import ZFP as mdio_ZFP # noqa: N811
52+ from mdio .schemas .compressors import ZFP as MDIO_ZFP
5153from mdio .schemas .compressors import Blosc as mdio_Blosc
5254from mdio .schemas .compressors import BloscAlgorithm as mdio_BloscAlgorithm
5355from mdio .schemas .compressors import BloscShuffle as mdio_BloscShuffle
@@ -342,11 +344,11 @@ def test__convert_compressor() -> None:
342344 assert result_blosc_zero .blocksize == 0
343345
344346 # Test 4: mdio_ZFP compressor - should return zfpy_ZFPY if available
345- zfp_compressor = mdio_ZFP (mode = mdio_ZFPMode .FIXED_RATE , tolerance = 0.01 , rate = 8.0 , precision = 16 )
347+ zfp_compressor = MDIO_ZFP (mode = mdio_ZFPMode .FIXED_RATE , tolerance = 0.01 , rate = 8.0 , precision = 16 )
346348
347349 if HAS_ZFPY :
348350 result_zfp = _convert_compressor (zfp_compressor )
349- assert isinstance (result_zfp , zfpy_ZFPY )
351+ assert isinstance (result_zfp , ZFPY )
350352 assert result_zfp .mode == 1 # ZFPMode.FIXED_RATE.value = "fixed_rate"
351353 assert result_zfp .tolerance == 0.01
352354 assert result_zfp .rate == 8.0
@@ -367,7 +369,7 @@ def test__convert_compressor() -> None:
367369 assert "<class 'str'>" in error_message
368370
369371
370- def test_to_xarray_dataset (tmp_path ) -> None : # noqa: ANN001 - tmp_path is a pytest fixture
372+ def test_to_xarray_dataset (tmp_path : Path ) -> None :
371373 """Test building a complete dataset."""
372374 dataset = (
373375 MDIODatasetBuilder ("test_dataset" )
@@ -394,7 +396,7 @@ def test_to_xarray_dataset(tmp_path) -> None: # noqa: ANN001 - tmp_path is a py
394396 to_zarr (xr_ds , file_path , mode = "w" )
395397
396398
397- def test_seismic_poststack_3d_acceptance_to_xarray_dataset (tmp_path ) -> None : # noqa: ANN001
399+ def test_seismic_poststack_3d_acceptance_to_xarray_dataset (tmp_path : Path ) -> None :
398400 """Test building a complete dataset."""
399401 dataset = make_seismic_poststack_3d_acceptance_dataset ()
400402
@@ -405,8 +407,8 @@ def test_seismic_poststack_3d_acceptance_to_xarray_dataset(tmp_path) -> None: #
405407
406408
407409@pytest .mark .skip (reason = "Issues serializing dask arrays of structured types to dask." )
408- def test_to_zarr_dask (tmp_path ) -> None : # noqa: ANN001
409- """Test writing XArray dataset with data as dask array to Zar ."""
410+ def test_to_zarr_dask (tmp_path : Path ) -> None :
411+ """Test writing XArray dataset with data as dask array to Zarr ."""
410412 # Create a data type and the fill value
411413 dtype = np_dtype ([("inline" , "int32" ), ("cdp-x" , "float64" )])
412414 dtype_fill_value = np_zeros ((), dtype = dtype )
@@ -429,8 +431,8 @@ def test_to_zarr_dask(tmp_path) -> None: # noqa: ANN001
429431 aa .to_zarr (file_path , mode = "w" , zarr_format = 2 , encoding = encoding , compute = False )
430432
431433
432- def test_to_zarr_zarr_zerros_1 (tmp_path ) -> None : # noqa: ANN001
433- """Test writing XArray dataset with data as Zarr zero array to Zar .
434+ def test_to_zarr_from_zarr_zeros_1 (tmp_path : Path ) -> None :
435+ """Test writing XArray dataset with data as Zarr zero array to Zarr .
434436
435437 Set encoding in as DataArray attributes
436438 """
@@ -455,8 +457,8 @@ def test_to_zarr_zarr_zerros_1(tmp_path) -> None: # noqa: ANN001
455457 aa .to_zarr (file_path , mode = "w" , zarr_format = 2 , compute = False )
456458
457459
458- def test_to_zarr_zarr_zerros_2 (tmp_path ) -> None : # noqa: ANN001
459- """Test writing XArray dataset with data as Zarr zero array to Zar .
460+ def test_to_zarr_from_zarr_zeros_2 (tmp_path : Path ) -> None :
461+ """Test writing XArray dataset with data as Zarr zero array to Zarr .
460462
461463 Set encoding in the to_zar method
462464 """
@@ -482,8 +484,8 @@ def test_to_zarr_zarr_zerros_2(tmp_path) -> None: # noqa: ANN001
482484 aa .to_zarr (file_path , mode = "w" , zarr_format = 2 , encoding = encoding , compute = False )
483485
484486
485- def test_to_zarr_np (tmp_path ) -> None : # noqa: ANN001
486- """Test writing XArray dataset with data as NumPy array to Zar ."""
487+ def test_to_zarr_from_np (tmp_path : Path ) -> None :
488+ """Test writing XArray dataset with data as NumPy array to Zarr ."""
487489 # Create a data type and the fill value
488490 dtype = np_dtype ([("inline" , "int32" ), ("cdp-x" , "float64" )])
489491 dtype_fill_value = np_zeros ((), dtype = dtype )
0 commit comments