Skip to content

Commit 9a7610d

Browse files
committed
docs: edit deprecation message with matching filter name instead of placeholder
1 parent c7f77d5 commit 9a7610d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

astroquery/simbad/core.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,13 @@ def add_votable_fields(self, *args):
392392
"https://astroquery.readthedocs.io/en/latest/simbad/simbad_evolution.html"
393393
" to see the new ways to interact with SIMBAD's fluxes.")
394394
if re.match(r"^flux.*\(.+\)$", arg):
395-
warnings.warn("The notation 'flux(XXX)' is deprecated since 0.4.8 in favor of 'XXX'. "
396-
"You will see the column appearing with its new name in the output. "
397-
"See section on filters in "
395+
filter_name = re.findall(r"\((\w+)\)", arg)[0]
396+
warnings.warn(f"The notation 'flux({filter_name})' is deprecated since 0.4.8 in favor of "
397+
f"'{filter_name}'. You will see the column appearing with its new name "
398+
"in the output. See section on filters in "
398399
"https://astroquery.readthedocs.io/en/latest/simbad/simbad_evolution.html "
399400
"to see the new ways to interact with SIMBAD's fluxes.", DeprecationWarning, stacklevel=2)
400-
fluxes_to_add.append(re.findall(r"\((\w+)\)", arg)[0])
401+
fluxes_to_add.append(filter_name)
401402
args.remove(arg)
402403

403404
# output options

astroquery/simbad/tests/test_simbad.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def test_add_votable_fields_errors():
271271
simbad_instance = simbad.SimbadClass()
272272
with pytest.raises(ValueError, match=r"The votable fields \'flux_\*\*\*\(filtername\)\' are removed *"):
273273
simbad_instance.add_votable_fields("flux_error(u)")
274-
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(XXX\)\' is deprecated since 0.4.8 *"):
274+
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(u\)\' is deprecated since 0.4.8 *"):
275275
simbad_instance.add_votable_fields("flux(u)")
276276
assert "u_" in str(simbad_instance.columns_in_output)
277277
# big letter J filter exists, but not small letter j
@@ -312,7 +312,7 @@ def test_add_votable_fields_errors():
312312
def test_add_list_of_fluxes():
313313
# regression test for https://github.com/astropy/astroquery/issues/3185#issuecomment-2599191953
314314
simbad_instance = simbad.Simbad()
315-
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(XXX\)\' is deprecated since 0.4.8 *"):
315+
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\([UJ]\)\' is deprecated since 0.4.8 *"):
316316
simbad_instance.add_votable_fields("flux(U)", "flux(J)")
317317

318318

0 commit comments

Comments
 (0)