Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate svo_fps query parameter names locally #2446

Merged
merged 3 commits into from
Jun 20, 2022

Conversation

eerovaher
Copy link
Member

SvoFpsClass.data_from_svo() now checks the names of the query parameters and only connects with the server if all names are valid. This allows replacing a failing remote test that checked for invalid queries with a local test.

Contributes towards #2203

@codecov
Copy link

codecov bot commented Jun 17, 2022

Codecov Report

Merging #2446 (7eab91e) into main (f5ff578) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2446      +/-   ##
==========================================
+ Coverage   62.90%   62.92%   +0.01%     
==========================================
  Files         133      133              
  Lines       17291    17300       +9     
==========================================
+ Hits        10877    10886       +9     
  Misses       6414     6414              
Impacted Files Coverage Δ
astroquery/svo_fps/core.py 95.23% <100.00%> (+1.29%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@bsipocz bsipocz added this to the v0.4.7 milestone Jun 20, 2022
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a short changelog mention after all the API has changed to correctly raise an exception rather than return an empty result.

Otherwise all looks good.


__all__ = ['SvoFpsClass', 'SvoFps']

FLOAT_MAX = np.finfo(np.float64).max

# Valid query parameters taken from
# http://svo2.cab.inta-csic.es/theory/fps/index.php?mode=voservice
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to parse this in rather than hard wire the params? I suppose they may not change it too often, so the hard-wiring should also work in practice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the parameter names are not hard-coded here then they have to be monkeypatched for non-remote tests, which requires them to be hard-coded there. I have instead added a new remote test that should raise alarms if QUERY_PARAMETER becomes outdated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a solid middle ground, thanks.

`SvoFpsClass.data_from_svo()` now checks the names of the query
parameters and only connects with the server if all names are valid.
The new remote test requests valid parameter names from the server and
checks that `QUERY_PARAMETERS` has not become outdated.
@eerovaher eerovaher force-pushed the svo-fps-query-params branch from 9a8d9bb to 7eab91e Compare June 20, 2022 19:32
@eerovaher eerovaher requested a review from bsipocz June 20, 2022 19:40
@bsipocz bsipocz merged commit 5dd8f78 into astropy:main Jun 20, 2022
@bsipocz bsipocz mentioned this pull request Jun 20, 2022
28 tasks
@eerovaher eerovaher deleted the svo-fps-query-params branch June 20, 2022 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants