Add tests for copying into a cupy view
@@ -220,3 +220,15 @@ class TestNumPyArrayCopyView(unittest.TestCase):
b = xp.empty(a.shape, dtype=dtype, order=order)
b[:] = a
return b
+
+ @unittest.skipUnless(util.ENABLE_SLICE_COPY, 'Special copy disabled')
+ @testing.for_orders('CF')
+ @testing.for_dtypes([numpy.int16, numpy.int64,
+ numpy.float16, numpy.float64])
+ @testing.numpy_cupy_array_equal()
+ def test_copy_host_to_device_view(self, xp, dtype, order):
+ dev = xp.empty((10, 10), dtype=dtype, order=order)[2:5, 1:8]
+ host = numpy.arange(3 * 7, dtype=dtype).reshape(
+ 3, 7, order=self.src_order)
+ dev[:] = host
+ return dev
