diff --git a/tests/utils/test_phase_center_catalog.py b/tests/utils/test_phase_center_catalog.py index b1d0d7c0f..a54a709ca 100644 --- a/tests/utils/test_phase_center_catalog.py +++ b/tests/utils/test_phase_center_catalog.py @@ -4,12 +4,27 @@ import pytest +from pyuvdata import UVData import pyuvdata.utils.phase_center_catalog as ps_cat_utils + def test_generate_new_phase_center_id_errs(): with pytest.raises(ValueError, match="Cannot specify old_id if no catalog"): ps_cat_utils.generate_new_phase_center_id(old_id=1) with pytest.raises(ValueError, match="Provided cat_id was found in reserved_ids"): ps_cat_utils.generate_new_phase_center_id(cat_id=1, reserved_ids=[1, 2, 3]) + + +def test_look_in_catalog_missing_entries(): + phase_cat = UVData().phase_center_catalog + # Try that this works normally if we do nothing + assert ps_cat_utils.look_in_catalog(phase_cat, cat_name=phase_cat[0]['cat_name']) == (0, 5) + + # Now delete some keys + for value in phase_cat.values(): + if 'cat_times' in value: + del value['cat_times'] + # Now re-run the above and verify things work as expected + assert ps_cat_utils.look_in_catalog(phase_cat, cat_name=phase_cat[0]['cat_name']) == (0, 5)