@@ -2163,6 +2163,7 @@ def test_encoding_unlimited_dims(self):
2163
2163
2164
2164
@requires_h5netcdf
2165
2165
@requires_netCDF4
2166
+ @pytest .mark .filterwarnings ("ignore:use make_scale(name) instead" )
2166
2167
class TestH5NetCDFData (NetCDF4Base ):
2167
2168
engine = "h5netcdf"
2168
2169
@@ -2173,16 +2174,25 @@ def create_store(self):
2173
2174
2174
2175
@pytest .mark .filterwarnings ("ignore:complex dtypes are supported by h5py" )
2175
2176
@pytest .mark .parametrize (
2176
- "invalid_netcdf, warns , num_warns" ,
2177
+ "invalid_netcdf, warntype , num_warns" ,
2177
2178
[(None , FutureWarning , 1 ), (False , FutureWarning , 1 ), (True , None , 0 )],
2178
2179
)
2179
- def test_complex (self , invalid_netcdf , warns , num_warns ):
2180
+ def test_complex (self , invalid_netcdf , warntype , num_warns ):
2180
2181
expected = Dataset ({"x" : ("y" , np .ones (5 ) + 1j * np .ones (5 ))})
2181
2182
save_kwargs = {"invalid_netcdf" : invalid_netcdf }
2182
- with pytest .warns (warns ) as record :
2183
+ with pytest .warns (warntype ) as record :
2183
2184
with self .roundtrip (expected , save_kwargs = save_kwargs ) as actual :
2184
2185
assert_equal (expected , actual )
2185
- assert len (record ) == num_warns
2186
+
2187
+ recorded_num_warns = 0
2188
+ if warntype :
2189
+ for warning in record :
2190
+ if issubclass (warning .category , warntype ) and (
2191
+ "complex dtypes" in str (warning .message )
2192
+ ):
2193
+ recorded_num_warns += 1
2194
+
2195
+ assert recorded_num_warns == num_warns
2186
2196
2187
2197
def test_cross_engine_read_write_netcdf4 (self ):
2188
2198
# Drop dim3, because its labels include strings. These appear to be
@@ -2451,6 +2461,7 @@ def skip_if_not_engine(engine):
2451
2461
2452
2462
2453
2463
@requires_dask
2464
+ @pytest .mark .filterwarnings ("ignore:use make_scale(name) instead" )
2454
2465
def test_open_mfdataset_manyfiles (
2455
2466
readengine , nfiles , parallel , chunks , file_cache_maxsize
2456
2467
):
0 commit comments