Skip to content

Commit

Permalink
docs: edit deprecation message with matching filter name instead of p…
Browse files Browse the repository at this point in the history
…laceholder
  • Loading branch information
ManonMarchand committed Jan 21, 2025
1 parent b8fac83 commit af6a90f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions astroquery/simbad/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,13 @@ def add_votable_fields(self, *args):
"https://astroquery.readthedocs.io/en/latest/simbad/simbad_evolution.html"
" to see the new ways to interact with SIMBAD's fluxes.")
if re.match(r"^flux.*\(.+\)$", arg):
warnings.warn("The notation 'flux(XXX)' is deprecated since 0.4.8 in favor of 'XXX'. "
"You will see the column appearing with its new name in the output. "
"See section on filters in "
filter_name = re.findall(r"\((\w+)\)", arg)[0]
warnings.warn(f"The notation 'flux({filter_name})' is deprecated since 0.4.8 in favor of "
f"'{filter_name}'. You will see the column appearing with its new name "
"in the output. See section on filters in "
"https://astroquery.readthedocs.io/en/latest/simbad/simbad_evolution.html "
"to see the new ways to interact with SIMBAD's fluxes.", DeprecationWarning, stacklevel=2)
fluxes_to_add.append(re.findall(r"\((\w+)\)", arg)[0])
fluxes_to_add.append(filter_name)
args.remove(arg)

# output options
Expand Down
4 changes: 2 additions & 2 deletions astroquery/simbad/tests/test_simbad.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def test_add_votable_fields_errors():
simbad_instance = simbad.SimbadClass()
with pytest.raises(ValueError, match=r"The votable fields \'flux_\*\*\*\(filtername\)\' are removed *"):
simbad_instance.add_votable_fields("flux_error(u)")
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(XXX\)\' is deprecated since 0.4.8 *"):
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(u\)\' is deprecated since 0.4.8 *"):
simbad_instance.add_votable_fields("flux(u)")
assert "u_" in str(simbad_instance.columns_in_output)
# big letter J filter exists, but not small letter j
Expand Down Expand Up @@ -310,7 +310,7 @@ def test_add_votable_fields_errors():
def test_add_list_of_fluxes():
# regression test for https://github.com/astropy/astroquery/issues/3185#issuecomment-2599191953
simbad_instance = simbad.Simbad()
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\(XXX\)\' is deprecated since 0.4.8 *"):
with pytest.warns(DeprecationWarning, match=r"The notation \'flux\([UJ]\)\' is deprecated since 0.4.8 *"):
simbad_instance.add_votable_fields("flux(U)", "flux(J)")


Expand Down

0 comments on commit af6a90f

Please sign in to comment.