18 lines
429 B
Python
18 lines
429 B
Python
import math, pytest
|
|
from matrixmania import rot_3D
|
|
|
|
def test_rot_3D_x_axis():
|
|
angle = math.pi / 2
|
|
R = rot_3D(angle, 'x')
|
|
expected = [
|
|
[1, 0, 0],
|
|
[0, 0, -1],
|
|
[0, 1, 0]
|
|
]
|
|
for r, e in zip(R, expected):
|
|
for rv, ev in zip(r, e):
|
|
assert math.isclose(rv, ev, abs_tol=1e-9)
|
|
|
|
def test_rot_3D_invalid_axis():
|
|
with pytest.raises(ValueError):
|
|
rot_3D(math.pi/4, 'a') |