def test_negative_rotation_from_carla(): """ Test that Rotation throws a ValueError if incorrect carla_rot argument is passed. """ DummyType = namedtuple("DummyType", "pitch, yaw, roll") dummy_instance = DummyType(10, 20, 30) with pytest.raises(ValueError): Rotation.from_carla_rotation(dummy_instance)
def test_rotation_from_carla(pitch, yaw, roll): """ Test that the Rotation is initialized correctly from a carla.Rotation instance """ carla_rotation = carla.Rotation(pitch, yaw, roll) rotation = Rotation.from_carla_rotation(carla_rotation) assert np.isclose(rotation.pitch, pitch), "pitch values are not the same." assert np.isclose(rotation.yaw, yaw), "yaw values are not the same." assert np.isclose(rotation.roll, roll), "roll values are not the same."