Skip to content

Commit e6c4eaa

Browse files
committed
order reduce
1 parent 16c7850 commit e6c4eaa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

xarray_array_testing/reduction.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,17 @@ def test_variable_boolean_reduce(self, op, data):
3939

4040
assert isinstance(actual, self.array_type)
4141
self.assert_equal(actual, expected)
42+
43+
@pytest.mark.parametrize("op", ["max", "min"])
44+
@given(st.data())
45+
def test_variable_order_reduce(self, op, data):
46+
variable = data.draw(xrst.variables(array_strategy_fn=self.array_strategy_fn))
47+
48+
with self.expected_errors(op, variable=variable):
49+
# compute using xr.Variable.<OP>()
50+
actual = getattr(variable, op)().data
51+
# compute using xp.<OP>(array)
52+
expected = getattr(self.xp, op)(variable.data)
53+
54+
assert isinstance(actual, self.array_type)
55+
self.assert_equal(actual, expected)

0 commit comments

Comments
 (0)