-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
TST: Add more tests for np.pad #11961
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
Conversation
numpy/lib/tests/test_arraypad.py
Outdated
def test_same_prepend_append(self, mode): | ||
# Check if the prepended and appended values are the same. | ||
# Regression test for issue gh-11216 | ||
a = np.array([-1, 2, -1]) + np.array([0, 1e-12, 0], dtype=np.float64) |
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 it is best if we keep this test just for 'mean'. The other functions will not suffer from this bug.
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.
Why not test them anyway?
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 get it, but this is very convoluted targeted test.
I think it can definitely make use of a "in source" comment summarizing the issue.
We are essentially testing the implementation of the algorithm as well as the peculiarities of floating point numbers. it is easy to understand why maximum
and minimum
are not likely to suffer from this bug. median
will also not suffer from this.
If we want to test the general behaviour for all 4 other modes, I think it is better to have them in a more general different test and keep this particular test very targeted.
Would this be a good opportunity to include a test covering the behavior described in #11358 (comment):
as well? |
20c754c
to
59c0e51
Compare
@lagru: I don't thing the current output is really correct for that either. I suppose I could add another xfailing test for that. |
@eric-wieser That is the behavior of the old pad function. Would you expect the output to be |
@lagru: Indeed it is, and yes I would. I think the best option here is |
59c0e51
to
40f9c68
Compare
Added that test, and updated the comments in the other test |
The test is marked xfail right now as it is not fixed in master
…ently rounds to `float`
40f9c68
to
d26ad30
Compare
Thanks Eric. |
Extracted from #11358 + the addition of an
xfail
marker.