Add test to properly handle AxisError.
@@ -626,8 +626,17 @@ class TestArgpartition(unittest.TestCase):
axis = 3
return self.argpartition(a, kth, axis=axis)
+ @testing.with_requires('numpy>=1.13')
@testing.numpy_cupy_raises()
- def test_argpartition_invalid_negative_axis(self, xp):
+ def test_argpartition_invalid_negative_axis1(self, xp):
+ a = testing.shaped_random((2, 2, 2), xp, scale=100)
+ kth = 1
+ axis = -4
+ return self.argpartition(a, kth, axis=axis)
+
+ @testing.with_requires('numpy<1.13')
+ @testing.numpy_cupy_raises(accept=ValueError)
+ def test_argpartition_invalid_negative_axis2(self, xp):
a = testing.shaped_random((2, 2, 2), xp, scale=100)
kth = 1
axis = -4
