Skip to content

Commit

Permalink
Merge pull request #13 from PlasmaFAIR/improve_test_coverage
Browse files Browse the repository at this point in the history
Add test that Sigma `__post_init__` works correctly
  • Loading branch information
LiamPattinson authored Sep 10, 2024
2 parents 94590fa + cd33f50 commit ec9a9e9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/test_cocos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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)

0 comments on commit ec9a9e9

Please sign in to comment.