Skip to content

Commit fdd995c

Browse files
committed
fix the expected value for cumulative reductions
`Variable` implements n-d cum ops by iterating over the axes.
1 parent 28ff45c commit fdd995c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xarray_array_testing/reduction.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def test_variable_cumulative_reduce(self, op, data):
8787
# compute using xr.Variable.<OP>()
8888
actual = getattr(variable, op)().data
8989
# compute using xp.<OP>(array)
90-
expected = getattr(self.xp, array_api_names[op])(variable.data)
90+
# Variable implements n-d cumulative ops by iterating over dims
91+
expected = variable.data
92+
for axis in range(variable.ndim):
93+
expected = getattr(self.xp, array_api_names[op])(expected, axis=axis)
9194

9295
assert isinstance(actual, self.array_type)
9396
self.assert_equal(actual, expected)

0 commit comments

Comments
 (0)