fix tests to pass with NumPy 1.10
@@ -8,8 +8,6 @@ from cupy import testing
{'repeats': 2, 'axis': None},
{'repeats': 2, 'axis': 1},
{'repeats': 2, 'axis': -1},
- {'repeats': [2], 'axis': None},
- {'repeats': [2], 'axis': 1},
{'repeats': [0, 0, 0], 'axis': 1},
{'repeats': [1, 2, 3], 'axis': 1},
{'repeats': [1, 2, 3], 'axis': -2},
@@ -25,12 +23,29 @@ class TestRepeat(unittest.TestCase):
return xp.repeat(x, self.repeats, self.axis)
+@testing.parameterize(
+ {'repeats': [2], 'axis': None},
+ {'repeats': [2], 'axis': 1},
+)
+@testing.gpu
+@testing.with_requires('numpy>=1.10')
+class TestRepeatListBroadcast(unittest.TestCase):
+
+ """Test for `repeats` argument using single element list.
+
+ This feature is only supported in NumPy 1.10 or later.
+ """
+
+ @testing.numpy_cupy_array_equal()
+ def test_array_repeat(self, xp):
+ x = testing.shaped_arange((2, 3, 4), xp)
+ return xp.repeat(x, self.repeats, self.axis)
+
+
@testing.parameterize(
{'repeats': 0, 'axis': None},
{'repeats': 2, 'axis': None},
{'repeats': 2, 'axis': 0},
- {'repeats': [2], 'axis': None},
- {'repeats': [2], 'axis': 0},
{'repeats': [1, 2, 3, 4], 'axis': None},
{'repeats': [1, 2, 3, 4], 'axis': 0},
)
@@ -43,6 +58,22 @@ class TestRepeat1D(unittest.TestCase):
return xp.repeat(x, self.repeats, self.axis)
+@testing.parameterize(
+ {'repeats': [2], 'axis': None},
+ {'repeats': [2], 'axis': 0},
+)
+@testing.gpu
+@testing.with_requires('numpy>=1.10')
+class TestRepeat1DListBroadcast(unittest.TestCase):
+
+ """See comment in TestRepeatListBroadcast class."""
+
+ @testing.numpy_cupy_array_equal()
+ def test_array_repeat(self, xp):
+ x = testing.shaped_arange((4,), xp)
+ return xp.repeat(x, self.repeats, self.axis)
+
+
@testing.parameterize(
{'repeats': -3, 'axis': None},
{'repeats': [-3, -3], 'axis': 0},
