Skip to content

Commit 20e6236

Browse files
authored
remove datetime tests with pint (#3788)
* don't try to wrap datetime objects in pint * make sure we actually decide based on dask.array.Array * update whats-new.rst * directly use isnat * always use numpy's isnat
1 parent fd08842 commit 20e6236

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

doc/whats-new.rst

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Internal Changes
5858
- Removed the internal ``import_seaborn`` function which handled the deprecation of
5959
the ``seaborn.apionly`` entry point (:issue:`3747`).
6060
By `Mathias Hauser <https://github.com/mathause>`_.
61+
- Don't test pint integration in combination with datetime objects. (:issue:`3778`, :pull:`3788`)
62+
By `Justus Magin <https://github.com/keewis>`_.
6163
- Changed test_open_mfdataset_list_attr to only run with dask installed
6264
(:issue:`3777`, :pull:`3780`).
6365
By `Bruno Pagani <https://github.com/ArchangeGabriel>`_.

xarray/core/duck_array_ops.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,7 @@ def fail_on_dask_array_input(values, msg=None, func_name=None):
7171
isclose = _dask_or_eager_func("isclose")
7272

7373

74-
if hasattr(np, "isnat") and (
75-
dask_array is None or hasattr(dask_array_type, "__array_ufunc__")
76-
):
77-
# np.isnat is available since NumPy 1.13, so __array_ufunc__ is always
78-
# supported.
79-
isnat = np.isnat
80-
else:
81-
isnat = _dask_or_eager_func("isnull", eager_module=pd)
74+
isnat = np.isnat
8275
isnan = _dask_or_eager_func("isnan")
8376
zeros_like = _dask_or_eager_func("zeros_like")
8477

xarray/tests/test_units.py

+10
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,7 @@ def wrapper(cls):
13351335
"test_index_0d_datetime",
13361336
"test_index_0d_timedelta64",
13371337
"test_0d_time_data",
1338+
"test_index_0d_not_a_time",
13381339
"test_datetime64_conversion",
13391340
"test_timedelta64_conversion",
13401341
"test_pandas_period_index",
@@ -1357,6 +1358,15 @@ def cls(dims, data, *args, **kwargs):
13571358
dims, unit_registry.Quantity(data, unit_registry.m), *args, **kwargs
13581359
)
13591360

1361+
def example_1d_objects(self):
1362+
for data in [
1363+
range(3),
1364+
0.5 * np.arange(3),
1365+
0.5 * np.arange(3, dtype=np.float32),
1366+
np.array(["a", "b", "c"], dtype=object),
1367+
]:
1368+
yield (self.cls("x", data), data)
1369+
13601370
@pytest.mark.parametrize(
13611371
"func",
13621372
(

0 commit comments

Comments
 (0)