From fab900cfe7661da4f9778f9ade181cac91bddb9a Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Thu, 5 Dec 2024 10:23:45 -0700 Subject: [PATCH] dask tests: Avoid check for non-copies, xfail pandas comparison (#9857) --- xarray/tests/test_dask.py | 1 + xarray/tests/test_variable.py | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/xarray/tests/test_dask.py b/xarray/tests/test_dask.py index e3e12599926..068f57ed42d 100644 --- a/xarray/tests/test_dask.py +++ b/xarray/tests/test_dask.py @@ -791,6 +791,7 @@ def test_tokenize_duck_dask_array(self): class TestToDaskDataFrame: + @pytest.mark.xfail(reason="https://github.com/dask/dask/issues/11584") def test_to_dask_dataframe(self): # Test conversion of Datasets to dask DataFrames x = np.random.randn(10) diff --git a/xarray/tests/test_variable.py b/xarray/tests/test_variable.py index 7dc5ef0db94..f4f353eda7d 100644 --- a/xarray/tests/test_variable.py +++ b/xarray/tests/test_variable.py @@ -278,34 +278,30 @@ def test_0d_time_data(self): @pytest.mark.filterwarnings("ignore:Converting non-nanosecond") def test_datetime64_conversion(self): times = pd.date_range("2000-01-01", periods=3) - for values, preserve_source in [ - (times, True), - (times.values, True), - (times.values.astype("datetime64[s]"), False), - (times.to_pydatetime(), False), + for values in [ + times, + times.values, + times.values.astype("datetime64[s]"), + times.to_pydatetime(), ]: v = self.cls(["t"], values) assert v.dtype == np.dtype("datetime64[ns]") assert_array_equal(v.values, times.values) assert v.values.dtype == np.dtype("datetime64[ns]") - same_source = source_ndarray(v.values) is source_ndarray(values) - assert preserve_source == same_source @pytest.mark.filterwarnings("ignore:Converting non-nanosecond") def test_timedelta64_conversion(self): times = pd.timedelta_range(start=0, periods=3) - for values, preserve_source in [ - (times, True), - (times.values, True), - (times.values.astype("timedelta64[s]"), False), - (times.to_pytimedelta(), False), + for values in [ + times, + times.values, + times.values.astype("timedelta64[s]"), + times.to_pytimedelta(), ]: v = self.cls(["t"], values) assert v.dtype == np.dtype("timedelta64[ns]") assert_array_equal(v.values, times.values) assert v.values.dtype == np.dtype("timedelta64[ns]") - same_source = source_ndarray(v.values) is source_ndarray(values) - assert preserve_source == same_source def test_object_conversion(self): data = np.arange(5).astype(str).astype(object) @@ -2372,6 +2368,7 @@ def test_dask_rolling(self, dim, window, center): assert actual.shape == expected.shape assert_equal(actual, expected) + @pytest.mark.xfail(reason="https://github.com/dask/dask/issues/11585") def test_multiindex(self): super().test_multiindex()