Add tests for non-contiguous arrays
@@ -24,46 +24,52 @@ from cupy import testing
@testing.gpu
class TestFlatiterSubscript(unittest.TestCase):
+ @testing.for_CF_orders()
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal()
- def test_getitem(self, xp, dtype):
- a = testing.shaped_arange(self.shape, xp, dtype)
+ def test_getitem(self, xp, dtype, order):
+ a = testing.shaped_arange(self.shape, xp, dtype, order)
return a.flat[self.index]
+ @testing.for_CF_orders()
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal()
- def test_setitem_scalar(self, xp, dtype):
- a = xp.zeros(self.shape, dtype=dtype)
+ def test_setitem_scalar(self, xp, dtype, order):
+ a = xp.zeros(self.shape, dtype=dtype, order=order)
a.flat[self.index] = 1
return a
+ @testing.for_CF_orders()
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal()
- def test_setitem_ndarray_1d(self, xp, dtype):
+ def test_setitem_ndarray_1d(self, xp, dtype, order):
if numpy.isscalar(self.index):
return xp.array([]) # skip
- a = xp.zeros(self.shape, dtype=dtype)
- v = testing.shaped_arange((3,), xp, dtype)
+ a = xp.zeros(self.shape, dtype=dtype, order=order)
+ v = testing.shaped_arange((3,), xp, dtype, order)
a.flat[self.index] = v
return a
+ @testing.for_CF_orders()
@testing.for_all_dtypes()
@testing.numpy_cupy_array_equal()
- def test_setitem_ndarray_nd(self, xp, dtype):
+ def test_setitem_ndarray_nd(self, xp, dtype, order):
if numpy.isscalar(self.index):
return xp.array([]) # skip
- a = xp.zeros(self.shape, dtype=dtype)
- v = testing.shaped_arange((2, 3), xp, dtype)
+ a = xp.zeros(self.shape, dtype=dtype, order=order)
+ v = testing.shaped_arange((2, 3), xp, dtype, order)
a.flat[self.index] = v
return a
+ @testing.for_CF_orders()
@testing.for_all_dtypes_combination(('a_dtype', 'v_dtype'))
@testing.numpy_cupy_array_equal()
- def test_setitem_ndarray_different_types(self, xp, a_dtype, v_dtype):
+ def test_setitem_ndarray_different_types(
+ self, xp, a_dtype, v_dtype, order):
if numpy.isscalar(self.index):
return xp.array([]) # skip
- a = xp.zeros(self.shape, dtype=a_dtype)
- v = testing.shaped_arange((3,), xp, v_dtype)
+ a = xp.zeros(self.shape, dtype=a_dtype, order=order)
+ v = testing.shaped_arange((3,), xp, v_dtype, order)
with warnings.catch_warnings():
warnings.simplefilter('ignore', numpy.ComplexWarning)
a.flat[self.index] = v
