File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -359,9 +359,8 @@ def test_missing_dims(self):
359
359
360
360
# Now drop variable altogether, should raise an error
361
361
ds = ds .drop_vars ("time" )
362
- with self .assertRaises (RuntimeError ) as cm :
362
+ with self .assertRaisesRegex (RuntimeError , "time" ) :
363
363
Hazard .from_xarray_raster (ds , "" , "" )
364
- self .assertIn ("time" , str (cm .exception ))
365
364
366
365
# Expand time again
367
366
ds = ds .expand_dims (time = [np .datetime64 ("2022-01-01" )])
@@ -564,15 +563,13 @@ def test_errors(self):
564
563
self .assertIn ("Unknown coordinates passed: '['bar']'." , str (cm .exception ))
565
564
566
565
# Correctly specified, but the custom dimension does not exist
567
- with self .assertRaises (RuntimeError ) as cm :
566
+ with self .assertRaisesRegex (RuntimeError , "lalalatitude" ) :
568
567
Hazard .from_xarray_raster_file (
569
568
self .netcdf_path ,
570
569
"" ,
571
570
"" ,
572
571
coordinate_vars = dict (latitude = "lalalatitude" ),
573
572
)
574
- self .assertIn ("lalalatitude" , str (cm .exception ))
575
-
576
573
577
574
# Execute Tests
578
575
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments