Skip to content

Commit 45121c5

Browse files
committed
Test input validation
1 parent 81b8ac3 commit 45121c5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/test_funcs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,12 @@ def test_nd(self, xp: ModuleType, ndim: int):
13591359
y = self._partition(x, k, xp, axis=i)
13601360
self._assert_valid_partition(y, k, xp, axis=i)
13611361

1362+
def test_input_validation(self, xp: ModuleType):
1363+
with pytest.raises(TypeError):
1364+
_ = self._partition(xp.asarray(1), 1, xp)
1365+
with pytest.raises(ValueError, match="out of bounds"):
1366+
_ = self._partition(xp.asarray([1, 2]), 3, xp)
1367+
13621368

13631369
@pytest.mark.xfail_xp_backend(Backend.SPARSE, reason="no argsort")
13641370
class TestArgpartition(TestPartition):

0 commit comments

Comments
 (0)