Skip to content

Commit

Permalink
maint: add deprecation warning on find_datasets that can be replaced …
Browse files Browse the repository at this point in the history
…by query_region
  • Loading branch information
ManonMarchand committed Dec 19, 2024
1 parent 1abe734 commit 2a04790
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions astroquery/mocserver/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from astropy import units as u
from astropy.table import Table
from astropy.utils import deprecated

try:
from mocpy import MOC, TimeMOC, STMOC
Expand Down Expand Up @@ -222,6 +223,8 @@ def query_hips(
cache=cache,
)

@deprecated(since="v0.4.8",
alternative="query_region")
def find_datasets(
self, meta_data,
*,
Expand Down
4 changes: 3 additions & 1 deletion astroquery/mocserver/tests/test_mocserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from astropy import coordinates
from astropy.io.votable import parse_single_table
from astropy.table import Table
from astropy.utils.exceptions import AstropyDeprecationWarning

try:
from mocpy import MOC, STMOC, TimeMOC, FrequencyMOC
Expand Down Expand Up @@ -269,5 +270,6 @@ def test_cast_to_float():

def test_find_datasets():
# find datasets is useless as it does the same than query region
old = MOCServer.find_datasets(meta_data="ID=*Euclid*", get_query_payload=True)
with pytest.warns(AstropyDeprecationWarning, match="The find_datasets function *"):
old = MOCServer.find_datasets(meta_data="ID=*Euclid*", get_query_payload=True)
assert old == MOCServer.query_region(meta_data="ID=*Euclid*", get_query_payload=True)

0 comments on commit 2a04790

Please sign in to comment.