@@ -89,7 +89,11 @@ def test_cf_datetime(num_dates, units, calendar):
89
89
actual = coding .times .decode_cf_datetime (num_dates , units ,
90
90
calendar )
91
91
92
- assert_array_equal (expected , actual )
92
+ abs_diff = np .atleast_1d (abs (actual - expected )).astype (np .timedelta64 )
93
+ # once we no longer support versions of netCDF4 older than 1.1.5,
94
+ # we could do this check with near microsecond accuracy:
95
+ # https://github.com/Unidata/netcdf4-python/issues/355
96
+ assert (abs_diff <= np .timedelta64 (1 , 's' )).all ()
93
97
encoded , _ , _ = coding .times .encode_cf_datetime (actual , units ,
94
98
calendar )
95
99
if '1-1-1' not in units :
@@ -151,7 +155,11 @@ def test_decode_cf_datetime_non_iso_strings():
151
155
(np .arange (100 ), 'hours since 2000-01-01 0:00' )]
152
156
for num_dates , units in cases :
153
157
actual = coding .times .decode_cf_datetime (num_dates , units )
154
- assert_array_equal (actual , expected )
158
+ abs_diff = abs (actual - expected )
159
+ # once we no longer support versions of netCDF4 older than 1.1.5,
160
+ # we could do this check with near microsecond accuracy:
161
+ # https://github.com/Unidata/netcdf4-python/issues/355
162
+ assert (abs_diff <= np .timedelta64 (1 , 's' )).all ()
155
163
156
164
157
165
@pytest .mark .skipif (not has_cftime_or_netCDF4 , reason = 'cftime not installed' )
0 commit comments