Skip to content

Commit bc41eb2

Browse files
authored
Add dask stack tests (#5350)
1 parent 09d8a4a commit bc41eb2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

xarray/tests/test_dataarray.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,12 +2218,10 @@ def test_unstack_pandas_consistency(self):
22182218
actual = DataArray(s, dims="z").unstack("z")
22192219
assert_identical(expected, actual)
22202220

2221-
def test_stack_nonunique_consistency(self):
2222-
orig = DataArray(
2223-
[[0, 1], [2, 3]], dims=["x", "y"], coords={"x": [0, 1], "y": [0, 0]}
2224-
)
2225-
actual = orig.stack(z=["x", "y"])
2226-
expected = DataArray(orig.to_pandas().stack(), dims="z")
2221+
def test_stack_nonunique_consistency(self, da):
2222+
da = da.isel(time=0, drop=True) # 2D
2223+
actual = da.stack(z=["a", "x"])
2224+
expected = DataArray(da.to_pandas().stack(), dims="z")
22272225
assert_identical(expected, actual)
22282226

22292227
def test_to_unstacked_dataset_raises_value_error(self):

0 commit comments

Comments
 (0)