Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Fix some test warnings#7336
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
inv_total = np.where(total > 0, 1./total, 0) | ||
inv_total = np.zeros_like(total) | ||
mask = total > 0 | ||
inv_total[mask] = 1.0 / total[mask] |
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.
inv_total=np.reciprocal(total)inv_total[total<=0]=0
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.reciprocal
also warns about division by zero, which is the main reason for this change.
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.
Ah, I have missed the warning message when triednp.reciprocal
warnings.filterwarnings('ignore', | ||
'The finance module has been deprecated in mpl 2', | ||
MatplotlibDeprecationWarning) | ||
from pylab import * |
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.
Does the warning makes any sense?
This will also create a merge conflict to master.
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.
Well, that's a question for a different issue/PR, I think.
Anything done here will cause a conflict withmaster
, probably. We could backport your entire change to this file, but I thought that might be a bit drastic.
'ignore', | ||
'The set_color_cycle attribute was deprecated in version 1.5.', | ||
MatplotlibDeprecationWarning) | ||
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 fixed in the master already.
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.
Hmm, yes, I'll backport that instead so it doesn't generate much conflicts.
@@ -173,7 +171,7 @@ def test_throw_rendering_complexity_exceeded(): | |||
try: | |||
fig.savefig(io.BytesIO()) | |||
finally: | |||
rcParams['path.simplify'] = True | |||
plt.rcParams['path.simplify'] = True |
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 test hascleanup
decorator on it, why there is a manual cleanup?
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 don't know; I just backported the warning fixes from master (i.e., removal ofpylab
.)
Cherry-picked from master.
The intention is there, but `np.where` does not really avoid the warningsince the division still occurs.
Some of these are expected and can either be ignored or tested against. Others just require a small tweak to get working. See commit messages for some details.
There are still a few warnings left, such as#7334, though.