import unittest

from cupy import testing


@testing.gpu
class TestBasic(unittest.TestCase):

    _multiprocess_can_split_ = True

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_copyto(self, xp, dtype):
        a = testing.shaped_arange((2, 3, 4), xp, dtype)
        b = xp.empty((2, 3, 4), dtype=dtype)
        xp.copyto(b, a)
        return b

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_copyto_dtype(self, xp, dtype):
        a = testing.shaped_arange((2, 3, 4), xp, dtype='?')
        b = xp.empty((2, 3, 4), dtype=dtype)
        xp.copyto(b, a)
        return b

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_copyto_broadcast(self, xp, dtype):
        a = testing.shaped_arange((3, 1), xp, dtype)
        b = xp.empty((2, 3, 4), dtype=dtype)
        xp.copyto(b, a)
        return b

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_copyto_where(self, xp, dtype):
        a = testing.shaped_arange((2, 3, 4), xp, dtype)
        b = testing.shaped_reverse_arange((2, 3, 4), xp, dtype)
        c = testing.shaped_arange((2, 3, 4), xp, '?')
        xp.copyto(a, b, where=c)
        return a

@@ -35,16 +35,38 @@
 testing%0A
+from cupy import cuda%0A
 %0A%0A@testi
@@ -1246,8 +1246,358 @@
 eturn a%0A
+%0A    @testing.multi_gpu(2)%0A    @testing.for_all_dtypes()%0A    @testing.numpy_cupy_array_equal()%0A    def test_copyto_multigpu(self, xp, dtype):%0A        with cuda.Device(0):%0A            a = testing.shaped_arange((2, 3, 4), xp, dtype)%0A        with cuda.Device(1):%0A            b = xp.empty((2, 3, 4), dtype=dtype)%0A        xp.copyto(b, a)%0A        return b%0A

Add unittests for manipulation.basic.copyto