Fix tests for AxisError compat.
@@ -632,13 +632,21 @@ class TestArgpartition(unittest.TestCase):
self.assertTrue((a1[idx[kth]] < a1[idx[kth + 1:]]).all())
return idx[kth]
+ @testing.with_requires('numpy>=1.13')
@testing.numpy_cupy_raises()
- def test_argpartition_invalid_axis(self, xp):
+ def test_argpartition_invalid_axis1(self, xp):
a = testing.shaped_random((2, 2, 2), xp, scale=100)
kth = 1
axis = 3
return self.argpartition(a, kth, axis=axis)
+ def test_argpartition_invalid_axis2(self, xp):
+ a = testing.shaped_random((2, 2, 2), xp, scale=100)
+ kth = 1
+ axis = 3
+ with self.assertRaises(cupy.core.core._AxisError):
+ self.argpartition(a, kth, axis=axis)
+
@testing.with_requires('numpy>=1.13')
@testing.numpy_cupy_raises()
def test_argpartition_invalid_negative_axis1(self, xp):
@@ -647,10 +655,9 @@ class TestArgpartition(unittest.TestCase):
axis = -4
return self.argpartition(a, kth, axis=axis)
- @testing.with_requires('numpy<1.13')
- @testing.numpy_cupy_raises(accept_error=ValueError)
def test_argpartition_invalid_negative_axis2(self, xp):
a = testing.shaped_random((2, 2, 2), xp, scale=100)
kth = 1
axis = -4
- return self.argpartition(a, kth, axis=axis)
+ with self.assertRaises(cupy.core.core._AxisError):
+ self.argpartition(a, kth, axis=axis)
