-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Fix bugs found by testing in release mode. #10193
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
if dtypes_match: | ||
return | ||
else: | ||
raise AssertionError(msg) |
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 at best a workaround. It doesn't solve the underlying problem, so the following still has the warning-swallowing problems:
assert_equal(np.void(b'test'), np.datetime64('2017'))
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.
It may be incomplete, but I don't think it is a workaround, differing types should be handled with the NaT stuff, not passed on to "==". For the rest, I'm thinking that we should not intercept any of the warning exceptions, just raise all of them. It is only in development mode that they are raised, and those errors should also be fixed in development mode.
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 see two approaches here for the ==
fallback,
- Suppress deprecation warnings, assert_equal should do its thing regardless.
- Let deprecation warnings raise without conversion to
AssertionError
The first can lead to unexpected changes when deprecations expire, the second will generally require fixes or rewrites that could conceivably be difficult before the deprecation expires.
The test failed for numpy installed in release mode as the PendingDeprecationWarning issued by `object.__format__(a, '30')` was no longer converted to an error. The fix here is to make the test Python version dependent and suppress the warning when needed.
To be complete, the NaT handling needs to raise AssertionError when comparing NaT's with different types. That check was previously passed on and the resulting check, which would succeed in development mode because DeprecationWarning was converted to an error, warns in release mode.
0074201
to
b98e598
Compare
I'm going to put this in just to get 1.14 out. The long term question as to how we should handle deprecation warnings in |
Fix a couple of bugs found by testing in release mode, closes #10185.
BUG: Fix numpy.testing.assert_equal in release mode.
To be complete, the NaT handling needs to raise AssertionError when
comparing NaT's with different types. That check was previously passed
on and the resulting check, which would succeed in development mode
because DeprecationWarning was converted to an error, warns in release
mode.
BUG: Fix test_1d_format test.
The test failed for numpy installed in release mode as the
PendingDeprecationWarning issued by
object.__format__(a, '30')
was nolonger converted to an error. The fix here is to make the test Python
version dependent and suppress the warning when needed.