Fix CDIPS tests due to changes in CDIPS DR5 release
@@ -8,10 +8,14 @@ from lightkurve import search_lightcurve
from lightkurve.io.cdips import read_cdips_lightcurve
from lightkurve.io.detect import detect_filetype
+TEST_TIC_ID = 104669918
+TEST_FIT_URL = "https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HLSP/cdips/s0014/cam1_ccd1/hlsp_cdips_tess_ffi_gaiatwo0002030897830235411200-s0014-cam1-ccd1_tess_v01_llc.fits"
+
+
@pytest.mark.remote_data
def test_detect_cdips():
"""Can we detect the correct format for CDIPS files?"""
- url = "https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HLSP/cdips/s0008/cam3_ccd4/hlsp_cdips_tess_ffi_gaiatwo0005318059532750974720-0008-cam3-ccd4_tess_v01_llc.fits"
+ url = TEST_FIT_URL
f = fits.open(url)
assert detect_filetype(f) == "CDIPS"
@@ -20,7 +24,7 @@ def test_detect_cdips():
@pytest.mark.remote_data
def test_read_cdips():
"""Can we read CDIPS files?"""
- url = "https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HLSP/cdips/s0008/cam3_ccd4/hlsp_cdips_tess_ffi_gaiatwo0005318059532750974720-0008-cam3-ccd4_tess_v01_llc.fits"
+ url = TEST_FIT_URL
f = fits.open(url)
# Verify different extensions
fluxes = []
@@ -45,12 +49,13 @@ def test_read_cdips():
for i in range(11):
assert not np.array_equal(fluxes[i].value, fluxes[i+1].value)
+
@pytest.mark.remote_data
def test_search_cdips():
"""Can we search and download a cdips light curve?"""
- search = search_lightcurve("TIC 93270923", author="CDIPS", sector=8)
- assert len(search) == 1
+ search = search_lightcurve(f"TIC {TEST_TIC_ID}", author="CDIPS")
+ assert len(search) >= 1
assert search.table["author"][0] == "CDIPS"
lc = search.download()
assert type(lc).__name__ == "TessLightCurve"
- assert lc.sector == 8
+ assert hasattr(lc, "sector")
