Skip to content

Commit

Permalink
Update test_coding_times.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Aug 4, 2024
1 parent 4db0c4e commit c5a7d8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xarray/tests/test_coding_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ def test_cf_datetime(num_dates, units, calendar) -> None:
assert (abs_diff <= np.timedelta64(1, "s")).all()
encoded1, _, _ = encode_cf_datetime(actual, units, calendar)

assert_array_equal(num_dates, np.round(encoded1, 1))
assert_duckarray_allclose(num_dates, encoded1)

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


@requires_cftime
Expand Down

0 comments on commit c5a7d8a

Please sign in to comment.