@@ -4334,6 +4334,12 @@ def test_source_encoding_always_present():
4334
4334
assert ds .encoding ["source" ] == tmp
4335
4335
4336
4336
4337
+ def _assert_no_dates_out_of_range_warning (record ):
4338
+ undesired_message = "dates out of range"
4339
+ for warning in record :
4340
+ assert undesired_message not in str (warning .message )
4341
+
4342
+
4337
4343
@requires_scipy_or_netCDF4
4338
4344
@pytest .mark .parametrize ("calendar" , _STANDARD_CALENDARS )
4339
4345
def test_use_cftime_standard_calendar_default_in_range (calendar ):
@@ -4360,7 +4366,7 @@ def test_use_cftime_standard_calendar_default_in_range(calendar):
4360
4366
with open_dataset (tmp_file ) as ds :
4361
4367
assert_identical (expected_x , ds .x )
4362
4368
assert_identical (expected_time , ds .time )
4363
- assert not record
4369
+ _assert_no_dates_out_of_range_warning ( record )
4364
4370
4365
4371
4366
4372
@requires_cftime
@@ -4423,7 +4429,7 @@ def test_use_cftime_true(calendar, units_year):
4423
4429
with open_dataset (tmp_file , use_cftime = True ) as ds :
4424
4430
assert_identical (expected_x , ds .x )
4425
4431
assert_identical (expected_time , ds .time )
4426
- assert not record
4432
+ _assert_no_dates_out_of_range_warning ( record )
4427
4433
4428
4434
4429
4435
@requires_scipy_or_netCDF4
@@ -4452,7 +4458,7 @@ def test_use_cftime_false_standard_calendar_in_range(calendar):
4452
4458
with open_dataset (tmp_file , use_cftime = False ) as ds :
4453
4459
assert_identical (expected_x , ds .x )
4454
4460
assert_identical (expected_time , ds .time )
4455
- assert not record
4461
+ _assert_no_dates_out_of_range_warning ( record )
4456
4462
4457
4463
4458
4464
@requires_scipy_or_netCDF4
0 commit comments