@@ -160,6 +160,9 @@ def test__get_np_datatype() -> None:
160160 (ScalarType .COMPLEX128 , "complex128" ),
161161 (ScalarType .BOOL , "bool" ),
162162 ]
163+ err = "Expected ScalarType or StructuredType, got 'str'"
164+ with pytest .raises (ValueError , match = err ):
165+ _get_np_datatype ("parameter of invalid type" )
163166
164167 for scalar_type , expected_numpy_type in scalar_type_tests :
165168 result = _get_np_datatype (scalar_type )
@@ -194,9 +197,24 @@ def test__get_zarr_shape() -> None:
194197 d1 = NamedDimension (name = "inline" , size = 100 )
195198 d2 = NamedDimension (name = "crossline" , size = 200 )
196199 d3 = NamedDimension (name = "depth" , size = 300 )
200+ all_named_dims = {"inline" : d1 , "crossline" : d2 , "depth" : d3 }
201+ v1 = Variable (name = "named dims var" , data_type = ScalarType .FLOAT32 , dimensions = [d1 , d2 , d3 ])
202+ v2 = Variable (
203+ name = "str var" , data_type = ScalarType .FLOAT32 , dimensions = ["inline" , "crossline" , "depth" ]
204+ )
205+ Dataset (
206+ variables = [v1 , v2 ],
207+ metadata = _to_dictionary (
208+ [
209+ DatasetInfo (
210+ name = "test_dataset" , api_version = "1.0.0" , created_on = "2023-10-01T00:00:00Z"
211+ )
212+ ]
213+ ),
214+ )
197215
198- v = Variable ( name = "seismic 3d var" , data_type = ScalarType . FLOAT32 , dimensions = [ d1 , d2 , d3 ] )
199- assert _get_zarr_shape (v , all_named_dims = [ d1 , d2 , d3 ] ) == (100 , 200 , 300 )
216+ assert _get_zarr_shape ( v1 , all_named_dims ) == ( 100 , 200 , 300 )
217+ assert _get_zarr_shape (v2 , all_named_dims ) == (100 , 200 , 300 )
200218
201219
202220def test__get_zarr_chunks () -> None :
@@ -341,7 +359,6 @@ def test__convert_compressor() -> None:
341359 # Test 5: mdio_ZFP without zfpy installed - should raise ImportError
342360 with pytest .raises (ImportError ) as exc_info :
343361 _convert_compressor (zfp_compressor )
344-
345362 error_message = str (exc_info .value )
346363 assert "zfpy and numcodecs are required to use ZFP compression" in error_message
347364
0 commit comments