Skip to content

Commit e2981d3

Browse files
authored
Use assert_duckarray_allclose instead of rounding the array (#9313)
* Cleanup test_coding_times * Update test_coding_times.py * Update test_coding_times.py * Update test_coding_times.py
1 parent c508cc6 commit e2981d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xarray/tests/test_coding_times.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ def test_cf_datetime(num_dates, units, calendar) -> None:
146146
# https://github.com/Unidata/netcdf4-python/issues/355
147147
assert (abs_diff <= np.timedelta64(1, "s")).all()
148148
encoded1, _, _ = encode_cf_datetime(actual, units, calendar)
149-
assert_array_equal(num_dates, np.around(encoded1, 1))
149+
assert_duckarray_allclose(num_dates, encoded1)
150150

151151
if hasattr(num_dates, "ndim") and num_dates.ndim == 1 and "1000" not in units:
152152
# verify that wrapping with a pandas.Index works
153153
# note that it *does not* currently work to put
154154
# non-datetime64 compatible dates into a pandas.Index
155155
encoded2, _, _ = encode_cf_datetime(pd.Index(actual), units, calendar)
156-
assert_array_equal(num_dates, np.around(encoded2, 1))
156+
assert_duckarray_allclose(num_dates, encoded2)
157157

158158

159159
@requires_cftime

0 commit comments

Comments
 (0)