From 48a3d7c7051021498f52ce527b5a202270957247 Mon Sep 17 00:00:00 2001 From: Nschanche Date: Tue, 10 Dec 2024 17:12:39 -0500 Subject: [PATCH] changed to DeprecatedError instead of Warning --- src/lksearch/TESSSearch.py | 19 +++++++++---------- src/lksearch/utils.py | 3 ++- tests/test_missionsearch.py | 12 +++++------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/lksearch/TESSSearch.py b/src/lksearch/TESSSearch.py index ecbf971..fe89025 100644 --- a/src/lksearch/TESSSearch.py +++ b/src/lksearch/TESSSearch.py @@ -8,7 +8,7 @@ from astropy import units as u from astropy.coordinates import SkyCoord from astropy.time import Time -from astropy.utils.decorators import deprecated +#from astropy.utils.decorators import deprecated from astroquery.mast import Tesscut from tqdm import tqdm @@ -17,7 +17,7 @@ from .MASTSearch import MASTSearch from . import conf, config, log -from .utils import SearchDeprecationWarning +from .utils import SearchDeprecationError PREFER_CLOUD = conf.PREFER_CLOUD DOWNLOAD_CLOUD = conf.DOWNLOAD_CLOUD @@ -289,26 +289,25 @@ def _sort_TESS(self): ) self.table = df - @deprecated( - "1.0.1", - warning_type=SearchDeprecationWarning, - message="The {func} {obj_type} has been deprecated as astroquery no longer supports querying individual FFI files.", - ) + def search_sector_ffis( self, # tmin: Union[float, Time, tuple] = None, # tmax: Union[float, Time, tuple] = None, # search_radius: Union[float, u.Quantity] = 0.0001 * u.arcsec, # exptime: Union[str, int, tuple] = (0, 9999), - # sector: Union[int, type[None]], # = None, - # **extra_query_criteria, + sector: Union[int, type[None]], # = None, + **extra_query_criteria, ): """ DEPRECATED Returns a list of the FFIs available in a particular sector """ - return None + raise SearchDeprecationError( + "The search_sector_ffis method has been deprecated as astroquery no longer supports querying individual FFI files." + ) + def filter_table( self, diff --git a/src/lksearch/utils.py b/src/lksearch/utils.py index 4cf57b0..c041040 100644 --- a/src/lksearch/utils.py +++ b/src/lksearch/utils.py @@ -15,7 +15,8 @@ class SearchWarning(Warning): pass -class SearchDeprecationWarning(SearchWarning): + +class SearchDeprecationError(SearchError): """Class for all lksearch deprecation warnings.""" pass diff --git a/tests/test_missionsearch.py b/tests/test_missionsearch.py index 4da4392..381d6bd 100644 --- a/tests/test_missionsearch.py +++ b/tests/test_missionsearch.py @@ -13,8 +13,7 @@ import pandas as pd -from lksearch.utils import SearchError, SearchWarning - +from lksearch.utils import SearchError, SearchWarning, SearchDeprecationError from lksearch import MASTSearch, TESSSearch, KeplerSearch, K2Search from lksearch import conf import warnings @@ -432,12 +431,11 @@ def test_split_k2_campaigns(): assert search_c11.table["campaign"][1] == "11b" -@pytest.mark.skip( - reason="MAST has deprecated FFI search and retrieval through astroquery" -) def test_FFI_retrieval(): - """Can we find TESS individual FFI's""" - assert len(TESSSearch("Kepler 16b").search_sector_ffis(14)) == 1241 + """MAST has deprecated FFI search and retrieval through astroquery, so this function is now deprecated""" + with pytest.raises(SearchDeprecationError) as exc: + results = TESSSearch("Kepler 16b").search_sector_ffis(14) + assert "deprecated" in exc.value.args[0] def test_tesscut():