Skip to content

Commit c1d4a30

Browse files
committed
Test against xarray operation
1 parent 0c6e343 commit c1d4a30

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/xtensor/test_shape.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ def test_unstack_simple():
171171
x_np = np.arange(np.prod(x.type.shape), dtype=x.type.dtype).reshape(x.type.shape)
172172
x_test = DataArray(x_np, dims=x.type.dims)
173173
res = fn(x_test)
174-
np.testing.assert_allclose(
175-
res.values, x_np.reshape(2, 3, 5, 7).transpose(0, 3, 1, 2)
174+
expected = (
175+
DataArray(x_np.reshape(2, 3, 5, 7), dims=("a", "b", "c", "d"))
176+
.stack(bc=("b", "c"))
177+
.unstack("bc")
176178
)
179+
xr_assert_allclose(res, expected)

0 commit comments

Comments
 (0)