def test_mirror_2D_one_axis(): """ Test mirror() on a 2D array for one axis """ arr = np.zeros((16, 16), dtype=float) arr[15, 3] = 1 assert np.allclose(arr[:, ::-1], mirror(arr, axes=1)) assert np.allclose(arr[::-1, :], mirror(arr, axes=0))
def test_mirror_2D_all_axes(): """ Test mirror() on a 2D array for all axes """ arr = np.zeros((16, 16), dtype=float) arr[15, 3] = 1 assert np.allclose(arr[::-1, ::-1], mirror(arr))
def test_mirror_1D(): """ Test mirror() on a 1D array """ arr = np.zeros((16, ), dtype=float) arr[15] = 1 assert np.allclose(arr[::-1], mirror(arr))
def test_2D_one_axis(self): """ Test mirror() on a 2D array for one axis """ arr = np.zeros((16, 16), dtype=np.float) arr[15, 3] = 1 self.assertTrue(np.allclose(arr[:, ::-1], mirror(arr, axes=1))) self.assertTrue(np.allclose(arr[::-1, :], mirror(arr, axes=0)))
def test_2D_all_axes(self): """ Test mirror() on a 2D array for all axes """ arr = np.zeros((16, 16), dtype=np.float) arr[15, 3] = 1 self.assertTrue(np.allclose(arr[::-1, ::-1], mirror(arr)))
def test_1D(self): """ Test mirror() on a 1D array """ arr = np.zeros((16, ), dtype=np.float) arr[15] = 1 self.assertTrue(np.allclose(arr[::-1], mirror(arr)))