"""."""

import re

import numpy as np
import pytest

from association_studio.exp_metrics.check_yaw_quat import check_yaw_quat


def test_it() -> None:
    det_1z = np.zeros((10, 10))
    with pytest.raises(ValueError, match=re.escape('Quaternion must be a 1-dimensional array.')):
        check_yaw_quat(det_1z)

    with pytest.raises(ValueError, match=re.escape('Quaternion must be a 4-element array.')):
        check_yaw_quat(det_1z[0])

    with pytest.raises(ValueError, match=re.escape('Quaternion vector should be normalized.')):
        check_yaw_quat(det_1z[0, 3:7])

    det_1z[:, 4] = 1.0
    with pytest.raises(ValueError, match=re.escape('rx, ry are assumed to be zeros.')):
        check_yaw_quat(det_1z[0, 3:7])

    det_1z[:] = 0.0
    det_1z[:, 5] = 1.0
    with pytest.raises(ValueError, match=re.escape('rx, ry are assumed to be zeros.')):
        check_yaw_quat(det_1z[0, 3:7])

    det_1z[:] = 0.0
    det_1z[:, 3] = -0.5
    with pytest.raises(ValueError, match=re.escape('Scalar part should be positive.')):
        check_yaw_quat(det_1z[0, 3:7])
