Skip to content

Commit 5b4ff96

Browse files
committed
Add test that Sigma __post_init__ works correctly
1 parent e2b83a0 commit 5b4ff96

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_cocos.py

+12-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,14 @@ 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+
@pytest.mark.parametrize("bad_input", ["B_poloidal", "r_phi_z", "r_theta_phi"])
81+
def test_sigma_bad_inputs(bad_input):
82+
"""Test that Sigma raises an excpetion when given an inputs not in ``(-1, 1)``"""
83+
inputs = {
84+
k: (0 if k == bad_input else 1)
85+
for k in ("B_poloidal", "r_phi_z", "r_theta_phi")
86+
}
87+
with pytest.raises(ValueError, match=bad_input):
88+
Sigma(**inputs)

0 commit comments

Comments
 (0)