Skip to content

Commit ec9a9e9

Browse files
Merge pull request #13 from PlasmaFAIR/improve_test_coverage
Add test that Sigma `__post_init__` works correctly
2 parents 94590fa + cd33f50 commit ec9a9e9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/test_cocos.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55
import pytest
66

7-
from pyloidal.cocos import Transform, identify_cocos
7+
from pyloidal.cocos import Sigma, Transform, identify_cocos
88

99
ALL_COCOS = list(range(1, 9)) + list(range(11, 19))
1010

@@ -75,3 +75,15 @@ def test_cocos_transform():
7575
for cocos_add in (cocos + x * 10 for x in range(2)):
7676
for key in ("b_toroidal", "toroidal", "poloidal", "q"):
7777
assert getattr(Transform(cocos_add, cocos_add), key) == 1
78+
79+
80+
def test_sigma_bad_inputs():
81+
"""Test that Sigma raises an excpetion when given an inputs not in ``(-1, 1)``"""
82+
with pytest.raises(ValueError, match="B_poloidal"):
83+
Sigma(B_poloidal=2, r_phi_z=1, r_theta_phi=-1)
84+
85+
with pytest.raises(ValueError, match="r_phi_z"):
86+
Sigma(B_poloidal=-1, r_phi_z=0, r_theta_phi=-1)
87+
88+
with pytest.raises(ValueError, match="r_theta_phi"):
89+
Sigma(B_poloidal=-1, r_phi_z=1, r_theta_phi=-5)

0 commit comments

Comments
 (0)