Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 27, 2016
Merged

Fix some test warnings #7336

merged 9 commits into from
Oct 27, 2016

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Oct 24, 2016

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.

@QuLogic QuLogic added this to the 2.0 (style change major release) milestone Oct 24, 2016
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]
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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 tried np.reciprocal

warnings.filterwarnings('ignore',
'The finance module has been deprecated in mpl 2',
MatplotlibDeprecationWarning)
from pylab import *
Copy link
Member

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.

Copy link
Member Author

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 with master, 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)

Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test has cleanup decorator on it, why there is a manual cleanup?

Copy link
Member Author

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 of pylab.)

@tacaswell tacaswell changed the title Fix some test warnings [MRG+1] Fix some test warnings Oct 25, 2016
@Kojoley Kojoley merged commit 1b666c5 into matplotlib:v2.x Oct 27, 2016
@Kojoley Kojoley changed the title [MRG+1] Fix some test warnings Fix some test warnings Oct 27, 2016
@QuLogic QuLogic deleted the fix-test-warnings branch October 27, 2016 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants