Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fix missing .shape check for array data #14528
Fix missing .shape check for array data #14528
Changes from all commits
cbd57cc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Coverage is complaining about this TypeError, even though I did not add it. That said it is right in the sense that this TypeError is indeed never checked in any test.
More importantly: I can't think of any scenario where "data = np.array(data)" would actually raise an exception. Numpy seems to happily eat anything you throw at it, and if it is not array_like it will just create a 0-dimensional array containing the object. So I believe this part of the code is actually not needed. I will remove it.
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.
In this case, you may use
# pragma: no cover
to ask coverage to stop complaining. The check goes through diff even though you might not have really touched that code.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 think I would rather delete the try-except, assuming there's no way it will trigger (I don't think it should be possible, looking over at the documentation).
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.
That should be a separate PR, if you really want to pursue, as it is out of scope here.
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.
Fixed in the latest commit, this PR should be ready now.
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.
np.array([[1,2],[2,3,4]])
raises an exception, so let's just keep code as it is :)And covering all exceptions is not easy, not done most of the time, and not in the scope of this PR, so I don't mind if Coverage is complaining.
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.
Huh, weird that this
test_image.py
is not being ignored by coverage. @nstarman , is this setting being ignored? You moved it in #13266 .astropy/pyproject.toml
Line 359 in 1b41891
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.
For some reason it complains about coverage on test files while the rest of the tests are still running, but as soon as everything finishes it stops complaining. This also happened to my commit last week, but I have no clue why.
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 is because we have several jobs in the same build that upload coverage reports. They don't all check the same test suite. The most comprehensive one is also the slowest, so when that one is done is when you should have a look. I won't worry about the complains while the test suite is still running. 😸
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.
hm. This is what the coverage docs say:
AFAIK it should be working. I see
coverage[toml]
insetup[cfg]
.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.
Do you think we need a
**
instead of a*
? Or maybe a*/*
since this is one more level down?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.
Yeah, maybe
**
.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.
codecov was happy when the change was made in #13266, so maybe those files were already not ignored before that and we would need
**
. To be checked with another PR ?