Skip to content

Commit 660fc47

Browse files
committed
Unit tests
1 parent dac6dad commit 660fc47

File tree

1 file changed

+29
-21
lines changed

1 file changed

+29
-21
lines changed

astroquery/mast/tests/test_mast_remote.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -759,42 +759,36 @@ def test_catalogs_download_hsc_spectra(self, tmpdir):
759759
# TesscutClass tests #
760760
######################
761761

762-
def test_tesscut_get_sectors(self):
762+
@pytest.mark.parametrize("product", ["tica", "spoc"])
763+
def test_tesscut_get_sectors(self, product):
763764

764765
coord = SkyCoord(349.62609, -47.12424, unit="deg")
765-
sector_table = mast.Tesscut.get_sectors(coordinates=coord)
766+
sector_table = mast.Tesscut.get_sectors(coordinates=coord, product=product)
766767
assert isinstance(sector_table, Table)
767768
assert len(sector_table) >= 1
768-
assert "tess-s00" in sector_table['sectorName'][0]
769+
770+
name = "tess" if product == "spoc" else product
771+
assert f"{name}-s00" in sector_table['sectorName'][0]
772+
769773
assert sector_table['sector'][0] > 0
770774
assert sector_table['camera'][0] > 0
771775
assert sector_table['ccd'][0] > 0
772776

773-
# This should always return no results
774-
775-
with pytest.warns(NoResultsWarning):
776-
coord = SkyCoord(90, -66.5, unit="deg")
777-
sector_table = mast.Tesscut.get_sectors(coordinates=coord,
778-
radius=0)
779-
assert isinstance(sector_table, Table)
780-
assert len(sector_table) == 0
781-
782-
coord = SkyCoord(90, -66.5, unit="deg")
783-
with pytest.warns(NoResultsWarning):
784-
sector_table = mast.Tesscut.get_sectors(coordinates=coord, radius=0)
785-
assert isinstance(sector_table, Table)
786-
assert len(sector_table) == 0
787-
788-
sector_table = mast.Tesscut.get_sectors(objectname="M104")
777+
sector_table = mast.Tesscut.get_sectors(objectname="M104", product=product)
789778
assert isinstance(sector_table, Table)
790779
assert len(sector_table) >= 1
791-
assert "tess-s00" in sector_table['sectorName'][0]
780+
781+
name = "tess" if product == "spoc" else product
782+
assert f"{name}-s00" in sector_table['sectorName'][0]
783+
792784
assert sector_table['sector'][0] > 0
793785
assert sector_table['camera'][0] > 0
794786
assert sector_table['ccd'][0] > 0
795787

796-
# Moving target functionality testing
788+
def test_tesscut_get_sectors_mt(self):
797789

790+
# Moving target functionality testing (defaults to SPOC)
791+
coord = SkyCoord(349.62609, -47.12424, unit="deg")
798792
moving_target_name = 'Eleonora'
799793

800794
sector_table = mast.Tesscut.get_sectors(objectname=moving_target_name,
@@ -836,6 +830,20 @@ def test_tesscut_get_sectors(self):
836830
moving_target=True)
837831
assert error_mt_coord in str(error_msg.value)
838832

833+
# The TICA product option is not available for moving targets. This should default to SPOC.
834+
835+
moving_target_name = 'Eleonora'
836+
837+
with pytest.warns(InputWarning):
838+
sector_table = mast.Tesscut.get_sectors(objectname=moving_target_name, product='tica',
839+
moving_target=True)
840+
assert isinstance(sector_table, Table)
841+
assert len(sector_table) >= 1
842+
assert "tess-s00" in sector_table['sectorName'][0]
843+
assert sector_table['sector'][0] > 0
844+
assert sector_table['camera'][0] > 0
845+
assert sector_table['ccd'][0] > 0
846+
839847
def test_tesscut_download_cutouts(self, tmpdir):
840848

841849
coord = SkyCoord(349.62609, -47.12424, unit="deg")

0 commit comments

Comments
 (0)