|
44 | 44 | FirstElementAccessibleArray, |
45 | 45 | arm_xfail, |
46 | 46 | assert_array_equal, |
| 47 | + assert_duckarray_allclose, |
| 48 | + assert_duckarray_equal, |
47 | 49 | assert_no_warnings, |
48 | 50 | has_cftime, |
49 | 51 | requires_cftime, |
@@ -144,13 +146,13 @@ def test_cf_datetime(num_dates, units, calendar) -> None: |
144 | 146 | assert (abs_diff <= np.timedelta64(1, "s")).all() |
145 | 147 | encoded, _, _ = encode_cf_datetime(actual, units, calendar) |
146 | 148 |
|
147 | | - assert_array_equal(num_dates, np.round(encoded, 1)) |
| 149 | + assert_duckarray_allclose(num_dates, encoded) |
148 | 150 | if hasattr(num_dates, "ndim") and num_dates.ndim == 1 and "1000" not in units: |
149 | 151 | # verify that wrapping with a pandas.Index works |
150 | 152 | # note that it *does not* currently work to put |
151 | 153 | # non-datetime64 compatible dates into a pandas.Index |
152 | 154 | encoded, _, _ = encode_cf_datetime(pd.Index(actual), units, calendar) |
153 | | - assert_array_equal(num_dates, np.round(encoded, 1)) |
| 155 | + assert_duckarray_allclose(num_dates, encoded) |
154 | 156 |
|
155 | 157 |
|
156 | 158 | @requires_cftime |
@@ -893,10 +895,10 @@ def test_time_units_with_timezone_roundtrip(calendar) -> None: |
893 | 895 | ) |
894 | 896 |
|
895 | 897 | if calendar in _STANDARD_CALENDARS: |
896 | | - np.testing.assert_array_equal(result_num_dates, expected_num_dates) |
| 898 | + assert_duckarray_equal(result_num_dates, expected_num_dates) |
897 | 899 | else: |
898 | 900 | # cftime datetime arithmetic is not quite exact. |
899 | | - np.testing.assert_allclose(result_num_dates, expected_num_dates) |
| 901 | + assert_duckarray_allclose(result_num_dates, expected_num_dates) |
900 | 902 |
|
901 | 903 | assert result_units == expected_units |
902 | 904 | assert result_calendar == calendar |
|
0 commit comments