-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Removed needless functions from an io.ascii test helper file #15782 #16383
base: main
Are you sure you want to change the base?
Conversation
Fix assertions in test cases
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
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.
Welcome to Astropy 👋 and congratulations on your first pull request! 🎉
A project member will respond to you as soon as possible; in the meantime, please have a look over the Checklist for Contributed Code and make sure you've addressed as many of the questions there as possible.
If you feel that this pull request has not been responded to in a timely manner, please send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail feedback@astropy.org.
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 had a quick look at the changes to io.ascii
and it seems like only a couple of minor changes are needed there. However, a pull request addressing #15782 has no reason to edit anything outside io.ascii
, so all the changes elsewhere need to be undone.
astropy/io/ascii/tests/common.py
Outdated
def assert_equal(a, b): | ||
assert a == b | ||
# def assert_equal(a, b): | ||
# assert a == b |
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.
The functions should be deleted, not commented out.
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.
Thank you for your feedback. The commented code has been removed in the recent commit.
assert ( | ||
table["loggf"].description == | ||
"log10 of the gf value - logarithm base 10 of stat. weight times " | ||
"oscillator strength", | ||
) |
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.
Ruff correctly detects an F631 (assert-tuple) violation here. Our developer documentation recommends using the pre-commit
tool, which would automatically detect such mistakes before a commit was even made.
assert ( | |
table["loggf"].description == | |
"log10 of the gf value - logarithm base 10 of stat. weight times " | |
"oscillator strength", | |
) | |
assert ( | |
table["loggf"].description == | |
"log10 of the gf value - logarithm base 10 of stat. weight times " | |
"oscillator strength" | |
) |
@@ -13,6 +13,7 @@ | |||
import pytest | |||
from numpy import ma | |||
|
|||
from numpy import testing as npt |
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'm not sure if I would use this npt
alias, but it is used in some of our tests already, so there is precedent for this.
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.
–1 on adopting this. We have discussed this in one of the various PRs addressing the same issue before, and already concluded that from numpy.testing import assert_allclose
etc. is the preferred style (and already used with only the aforementioned 1 or 2 exceptions).
Maybe we should remove "package-novice" label from #15782 |
Also should note this in #16266 or ping @stefanarseneau on a response to #16266 (comment). |
We have at least 4 PRs now trying to address that issue and the diff here is too messy. I think we should close this without merge.
|
Out of all the related pull requests this seems to be closest to completion. The diff is not overly messy. It is far too large because of all the changes outside |
Remove unused import and compatibility functions
parantheses have been removed
To undo all the changes outside $ git reset --hard $(git merge-base main @)
$ git restore --source=@{u} astropy/io/ascii EDIT: the above instructions will not work in your case because you have opened the pull request from the $ git reset --hard $(git merge-base astropy/main @)
$ git restore --source=@{u} astropy/io/ascii But if in your local repository the main $ git reset --hard $(git merge-base origin/main @)
$ git restore --source=@{u} astropy/io/ascii |
Description
This pull request is to address ...
Fixes #15782
Description:
assert_equal
,assert_true
has been removed from "common.py" as well as other files.assert_allclose
has been used instead ofassert_almost_equal
.Performed removals