Skip to content

Commit

Permalink
dask tests: Avoid check for non-copies, xfail pandas comparison (#9857)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored Dec 5, 2024
1 parent 99ee8c6 commit fab900c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 11 additions & 14 deletions xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit fab900c

Please sign in to comment.