-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
BUG: raise for unsupported arguments for alma #2475
Conversation
Looks like a great solution! One minor nitpick: I think the convention is to use |
Codecov Report
@@ Coverage Diff @@
## main #2475 +/- ##
==========================================
- Coverage 62.92% 62.91% -0.02%
==========================================
Files 133 133
Lines 17302 17313 +11
==========================================
+ Hits 10888 10893 +5
- Misses 6414 6420 +6
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
You could also opt to warn with an |
Happily rectified. Thank you @keflavich. |
astroquery/alma/tests/test_alma.py
Outdated
with patch('astroquery.alma.tapsql.coord.SkyCoord.from_name') as name_mock, pytest.raises(ValueError) as typeError: | ||
name_mock.return_value = SkyCoord(1, 2, unit='deg') | ||
alma.query_object('M13', public=False, bogus=True, nope=False, band_list=[3]) | ||
assert "['bogus -> True', 'nope -> False']" in str(typeError.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with patch('astroquery.alma.tapsql.coord.SkyCoord.from_name') as name_mock, pytest.raises(ValueError) as typeError: | |
name_mock.return_value = SkyCoord(1, 2, unit='deg') | |
alma.query_object('M13', public=False, bogus=True, nope=False, band_list=[3]) | |
assert "['bogus -> True', 'nope -> False']" in str(typeError.value) | |
with patch('astroquery.alma.tapsql.coord.SkyCoord.from_name') as name_mock, pytest.raises(ValueError) as valueError: | |
name_mock.return_value = SkyCoord(1, 2, unit='deg') | |
alma.query_object('M13', public=False, bogus=True, nope=False, band_list=[3]) | |
assert "['bogus -> True', 'nope -> False']" in str(valueError.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totally minor, but may as well have the variable names match the objects
Right, oops. Done. |
Incorrect argument should raise a >>> print(bad_argument=0)
Traceback (most recent call last):
...
TypeError: 'bad_argument' is an invalid keyword argument for print() |
Oh, my bad. Sorry @at88mph , revert my suggestions. |
Done, thanks. |
@@ -162,6 +162,7 @@ | |||
def _gen_sql(payload): | |||
sql = 'select * from ivoa.obscore' | |||
where = '' | |||
unused_payload = payload.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how many things can be shuffled into **kwargs
in the first place, and therefore couldn't we actually address the route cause of this bug by spelling out those optional keyword arguments rather than hiding them in **kwargs
instead?
There was a problem hiding this 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 changelog before the release.
This PR looks good for doing a quick fix for the issue and thus I'm OK with merging, but honestly I would rather see all **kwargs
gone from the codebase instead. Would you think it's possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I have to retract my approval as some remote-data tests are failing with this PR. They are more like the case of wrong tests where extra arguments were passed along that this fix has recovered, yet they should be fixed before merging this.
I currently see these failures, but some are already present on the main
branch, and only some are due to changes here.
FAILED astroquery/alma/tests/test_alma_remote.py::TestAlma::test_public - TypeError: Unsupported arguments were passed:
FAILED astroquery/alma/tests/test_alma_remote.py::TestAlma::test_data_proprietary - AttributeError: uid://A001/X12a3/Xe9 not found
FAILED astroquery/alma/tests/test_alma_remote.py::TestAlma::test_data_info - assert 9 > 9
FAILED astroquery/alma/tests/test_alma_remote.py::TestAlma::test_doc_example - KeyError: 'size'
FAILED astroquery/alma/tests/test_alma_remote.py::TestAlma::test_misc - TypeError: Unsupported arguments were passed:
I see this now, thanks @bsipocz. 😵💫 The |
Added `CHANGES` entry.
I've added |
One more to go:
|
This was a bit of a rabbit hole. Running on Python 3.10:
I hope this change hasn't damaged anything that I don't know about. |
Thank you, and extra thanks for fixing/working around tests that are failing unrelatedly to this PR. |
Throw
TypeError
for unused arguments when generating query.