Skip to content

Commit

Permalink
test: cover exceptions in ska code
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed Jan 10, 2025
1 parent b1d0a42 commit ed3fcf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/py21cmsense/observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def from_ska(
"""
try:
from ska_ost_array_config.array_config import LowSubArray, MidSubArray
except ImportError as exception:
except ImportError as exception: # pragma: no cover
raise ImportError(
"ska-ost-array-config package is required, "
+ "see https://gitlab.com/ska-telescope/ost/ska-ost-array-config"
Expand Down
5 changes: 5 additions & 0 deletions tests/test_observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ def test_from_ska():
uvw_m = uvw.uvdist_m
assert np.allclose(obs.longest_baseline / obs.metres_to_wavelengths, uvw_m.max() * units.m)

with pytest.raises(ValueError, match="array_type must be"):
Observatory.from_ska(
subarray_type="AA*", array_type="non-existent", frequency=300.0 * units.MHz
)


def test_get_redundant_baselines(bm):
a = Observatory(antpos=np.array([[0, 0, 0], [1, 0, 0], [2, 0, 0]]) * units.m, beam=bm)
Expand Down

0 comments on commit ed3fcf4

Please sign in to comment.