@@ -2735,3 +2735,37 @@ def test_property_block_indexing_rectilinear(data: st.DataObject) -> None:
27352735 a [tuple (sel )],
27362736 err_msg = f"dim={ dim } , block={ block_ix } " ,
27372737 )
2738+
2739+
2740+ # ---------------------------------------------------------------------------
2741+ # Backwards-compatibility: import RegularChunkGrid from zarr.core.chunk_grids
2742+ # ---------------------------------------------------------------------------
2743+ # Downstream packages (tifffile, cubed, ismip-indexing) use this pattern:
2744+ # from zarr.core.chunk_grids import RegularChunkGrid
2745+ # RegularChunkGrid(chunk_shape=(...))
2746+
2747+
2748+ def test_regular_chunk_grid_import_from_chunk_grids () -> None :
2749+ """RegularChunkGrid can be imported from zarr.core.chunk_grids with deprecation warning."""
2750+ with pytest .warns (DeprecationWarning , match = "RegularChunkGrid" ):
2751+ from zarr .core .chunk_grids import RegularChunkGrid
2752+
2753+ assert RegularChunkGrid is RegularChunkGridMetadata
2754+
2755+
2756+ def test_regular_chunk_grid_construction_from_chunk_grids () -> None :
2757+ """RegularChunkGrid(chunk_shape=...) works when imported from zarr.core.chunk_grids."""
2758+ with pytest .warns (DeprecationWarning , match = "RegularChunkGrid" ):
2759+ from zarr .core .chunk_grids import RegularChunkGrid
2760+
2761+ grid = RegularChunkGrid (chunk_shape = (10 , 20 ))
2762+ assert grid .chunk_shape == (10 , 20 )
2763+
2764+
2765+ def test_regular_chunk_grid_isinstance_from_chunk_grids () -> None :
2766+ """isinstance check works for RegularChunkGrid imported from zarr.core.chunk_grids."""
2767+ with pytest .warns (DeprecationWarning , match = "RegularChunkGrid" ):
2768+ from zarr .core .chunk_grids import RegularChunkGrid
2769+
2770+ grid = RegularChunkGrid (chunk_shape = (10 , 20 ))
2771+ assert isinstance (grid , RegularChunkGrid )
0 commit comments