Skip to content

Commit cd33f50

Browse files
committed
Simplify Sigma __post_init__ test
1 parent 5b4ff96 commit cd33f50

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tests/test_cocos.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ def test_cocos_transform():
7777
assert getattr(Transform(cocos_add, cocos_add), key) == 1
7878

7979

80-
@pytest.mark.parametrize("bad_input", ["B_poloidal", "r_phi_z", "r_theta_phi"])
81-
def test_sigma_bad_inputs(bad_input):
80+
def test_sigma_bad_inputs():
8281
"""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)
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)