Пример #1
0
 def test_4D_rot_axis(self):
     array = np.array([[0.75, 0, 0], [0.25, 1, 0], [1, 0.75, 0]])
     with pytest.raises(ShapeError):
         rot90(array, rot_axis=[0.2, 0.7, 0, 0])
Пример #2
0
 def test_default_4_5(self):
     array = np.array([[0.75, 0], [0.25, 1], [1, 0.75], [0, 0.25]])
     with pytest.raises(InputError):
         rot90(array, n_rot=4.5)
Пример #3
0
 def test_invalid_rot_axis_str(self):
     array = np.array([[0.75, 0], [0.25, 1], [1, 0.75], [0, 0.25]])
     with pytest.raises(ValueError):
         rot90(array, rot_axis='test')
Пример #4
0
 def test_invalid_3D_rot_axis(self):
     array = np.array([[0.75, 0, 0], [0.25, 1, 0], [1, 0.75, 0]])
     with pytest.raises(ValueError):
         rot90(array, rot_axis=[0.2, 0, 0])
Пример #5
0
 def test_3_rot_axes(self):
     array = np.array([[0.75, 0], [0.25, 1], [1, 0.75], [0, 0.25]])
     with pytest.raises(InputError):
         rot90(array, axes=(0, 1, 2))
Пример #6
0
 def test_vector(self):
     vec = np.array([7, 8, 9])
     with pytest.raises(ShapeError):
         rot90(vec)
Пример #7
0
 def test_3D_rot_axis(self):
     array = np.array([[0.75, 0, 0], [0.25, 1, 0], [1, 0.75, 0]])
     assert np.allclose(
         rot90(array, rot_axis=[0.2, 0.7, 0]),
         np.array([[0.9, 1.25, 0], [-0.1, 0.75, 0], [0.15, 1.5, 0]]))
Пример #8
0
 def test_2D_rot_axis(self):
     array = np.array([[0.75, 0], [0.25, 1], [1, 0.75], [0, 0.25]])
     assert np.allclose(
         rot90(array, rot_axis=[0.2, 0.7]),
         np.array([[0.9, 1.25], [-0.1, 0.75], [0.15, 1.5], [0.65, 0.5]]))
Пример #9
0
 def test_default_3(self):
     array = np.array([[0.75, 0], [0.25, 1], [1, 0.75], [0, 0.25]])
     assert np.allclose(
         rot90(array, n_rot=3),
         np.array([[0, 0.25], [1, 0.75], [0.75, 0], [0.25, 1]]))