import unittest

from cupy import testing


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

    _multiprocess_can_split_ = True

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal(accept_error=TypeError)
    def test_roll(self, xp, dtype):
        x = xp.arange(10, dtype)
        return xp.roll(x, 2)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_roll2(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, 1)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_roll_negative(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, -2)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_roll_with_axis(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, 1, axis=0)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_roll_with_negative_axis(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, 1, axis=-1)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_roll_double_shift(self, xp, dtype):
        x = testing.shaped_arange((10,), xp, dtype)
        return xp.roll(x, 35)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_roll_double_shift_with_axis(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, 11, axis=0)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_array_equal()
    def test_roll_zero_array(self, xp, dtype):
        x = testing.shaped_arange((), xp, dtype)
        return xp.roll(x, 5)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_raises()
    def test_roll_invalid_axis(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, 1, axis=2)

    @testing.for_all_dtypes()
    @testing.numpy_cupy_raises()
    def test_roll_invalid_negative_axis(self, xp, dtype):
        x = testing.shaped_arange((5, 2), xp, dtype)
        return xp.roll(x, 1, axis=-3)

@@ -65,16 +65,11 @@
 estR
-earrange
+oll
 (uni
@@ -2145,8 +2145,1343 @@
 xis=-3)%0A
+%0A%0A@testing.gpu%0Aclass TestFliplr(unittest.TestCase):%0A%0A    _multiprocess_can_split_ = True%0A%0A    @testing.for_all_dtypes()%0A    @testing.numpy_cupy_array_equal()%0A    def test_fliplr_2(self, xp, dtype):%0A        x = testing.shaped_arange((3, 4), xp, dtype)%0A        return xp.fliplr(x)%0A%0A    @testing.for_all_dtypes()%0A    @testing.numpy_cupy_array_equal()%0A    def test_fliplr_3(self, xp, dtype):%0A        x = testing.shaped_arange((3, 4, 2), xp, dtype)%0A        return xp.fliplr(x)%0A%0A    @testing.for_all_dtypes()%0A    @testing.numpy_cupy_raises()%0A    def test_fliplr_insufficient_ndim(self, xp, dtype):%0A        x = testing.shaped_arange((3,), xp, dtype)%0A        return xp.fliplr(x)%0A%0A%0A@testing.gpu%0Aclass TestFlipud(unittest.TestCase):%0A%0A    _multiprocess_can_split_ = True%0A%0A    @testing.for_all_dtypes()%0A    @testing.numpy_cupy_array_equal()%0A    def test_flipud_1(self, xp, dtype):%0A        x = testing.shaped_arange((3,), xp, dtype)%0A        return xp.flipud(x)%0A%0A    @testing.for_all_dtypes()%0A    @testing.numpy_cupy_array_equal()%0A    def test_flipud_2(self, xp, dtype):%0A        x = testing.shaped_arange((3, 4), xp, dtype)%0A        return xp.flipud(x)%0A%0A    @testing.for_all_dtypes()%0A    @testing.numpy_cupy_raises()%0A    def test_flipud_insufficient_ndim(self, xp, dtype):%0A        x = testing.shaped_arange((), xp, dtype)%0A        return xp.flipud(x)%0A

Write test for fliplr and flipud