Skip to content

Commit 2312a31

Browse files
ManonMarchandbsipocz
authored andcommitted
maint: add deprecation warning on find_datasets that can be replaced by query_region
1 parent 1500a43 commit 2312a31

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

astroquery/mocserver/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from astropy import units as u
1212
from astropy.table import Table
13+
from astropy.utils import deprecated
1314

1415
try:
1516
from mocpy import MOC, TimeMOC, STMOC
@@ -222,6 +223,8 @@ def query_hips(
222223
cache=cache,
223224
)
224225

226+
@deprecated(since="v0.4.9",
227+
alternative="query_region")
225228
def find_datasets(
226229
self, meta_data,
227230
*,

astroquery/mocserver/tests/test_mocserver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from astropy import coordinates
88
from astropy.io.votable import parse_single_table
99
from astropy.table import Table
10+
from astropy.utils.exceptions import AstropyDeprecationWarning
1011

1112
try:
1213
from mocpy import MOC, STMOC, TimeMOC, FrequencyMOC
@@ -270,5 +271,6 @@ def test_cast_to_float():
270271

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

0 commit comments

Comments
 (0)