Skip to content

Commit 9e9addb

Browse files
authored
Merge pull request #2674 from ceb8/fix_coverage
Fixing code coverage
2 parents 5e221bc + 3b077e5 commit 9e9addb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

astroquery/mast/tests/test_mast.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,15 @@ def test_tesscut_get_sector(patch_post):
705705
mast.Tesscut.get_sectors(objectname='Ceres', moving_target=True, coordinates=coord)
706706
assert error_str in str(invalid_query.value)
707707

708+
# Testing invalid queries
709+
with pytest.raises(InvalidQueryError) as invalid_query:
710+
mast.Tesscut.get_sectors(objectname="M101", product="spooc")
711+
assert "Input product must either be SPOC or TICA." in str(invalid_query.value)
712+
713+
with pytest.raises(InvalidQueryError) as invalid_query:
714+
mast.Tesscut.get_sectors(objectname="M101", product="TICA", moving_target=True)
715+
assert "Only SPOC is available for moving targets queries." in str(invalid_query.value)
716+
708717

709718
def test_tesscut_download_cutouts(patch_post, tmpdir):
710719

@@ -754,6 +763,15 @@ def test_tesscut_download_cutouts(patch_post, tmpdir):
754763
path=str(tmpdir))
755764
assert error_str in str(invalid_query.value)
756765

766+
# Testing invalid queries
767+
with pytest.raises(InvalidQueryError) as invalid_query:
768+
mast.Tesscut.download_cutouts(objectname="M101", product="spooc")
769+
assert "Input product must either be SPOC or TICA." in str(invalid_query.value)
770+
771+
with pytest.raises(InvalidQueryError) as invalid_query:
772+
mast.Tesscut.download_cutouts(objectname="M101", product="TICA", moving_target=True)
773+
assert "Only SPOC is available for moving targets queries." in str(invalid_query.value)
774+
757775

758776
def test_tesscut_get_cutouts(patch_post, tmpdir):
759777

@@ -788,6 +806,15 @@ def test_tesscut_get_cutouts(patch_post, tmpdir):
788806
size=5)
789807
assert error_str in str(invalid_query.value)
790808

809+
# Testing invalid queries
810+
with pytest.raises(InvalidQueryError) as invalid_query:
811+
mast.Tesscut.get_cutouts(objectname="M101", product="spooc")
812+
assert "Input product must either be SPOC or TICA." in str(invalid_query.value)
813+
814+
with pytest.raises(InvalidQueryError) as invalid_query:
815+
mast.Tesscut.get_cutouts(objectname="M101", product="TICA", moving_target=True)
816+
assert "Only SPOC is available for moving targets queries." in str(invalid_query.value)
817+
791818

792819
######################
793820
# ZcutClass tests #

0 commit comments

Comments
 (0)