diff --git a/tests/test_cocos.py b/tests/test_cocos.py index 71b67ae..a7357a2 100644 --- a/tests/test_cocos.py +++ b/tests/test_cocos.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from pyloidal.cocos import Transform, identify_cocos +from pyloidal.cocos import Sigma, Transform, identify_cocos ALL_COCOS = list(range(1, 9)) + list(range(11, 19)) @@ -75,3 +75,15 @@ def test_cocos_transform(): for cocos_add in (cocos + x * 10 for x in range(2)): for key in ("b_toroidal", "toroidal", "poloidal", "q"): assert getattr(Transform(cocos_add, cocos_add), key) == 1 + + +def test_sigma_bad_inputs(): + """Test that Sigma raises an excpetion when given an inputs not in ``(-1, 1)``""" + with pytest.raises(ValueError, match="B_poloidal"): + Sigma(B_poloidal=2, r_phi_z=1, r_theta_phi=-1) + + with pytest.raises(ValueError, match="r_phi_z"): + Sigma(B_poloidal=-1, r_phi_z=0, r_theta_phi=-1) + + with pytest.raises(ValueError, match="r_theta_phi"): + Sigma(B_poloidal=-1, r_phi_z=1, r_theta_phi=-5)