Skip to content

Commit 242a324

Browse files
committed
index ordering tests
1 parent e6c4eaa commit 242a324

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
@@ -53,3 +53,17 @@ def test_variable_order_reduce(self, op, data):
5353

5454
assert isinstance(actual, self.array_type)
5555
self.assert_equal(actual, expected)
56+
57+
@pytest.mark.parametrize("op", ["argmax", "argmin"])
58+
@given(st.data())
59+
def test_variable_order_reduce_index(self, op, data):
60+
variable = data.draw(xrst.variables(array_strategy_fn=self.array_strategy_fn))
61+
62+
with self.expected_errors(op, variable=variable):
63+
# compute using xr.Variable.<OP>()
64+
actual = getattr(variable, op)().data
65+
# compute using xp.<OP>(array)
66+
expected = getattr(self.xp, op)(variable.data)
67+
68+
assert isinstance(actual, self.array_type)
69+
self.assert_equal(actual, expected)

0 commit comments

Comments
 (0)