-
-
Notifications
You must be signed in to change notification settings - Fork 7.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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some test warnings #7336
Changes from all commits
68681da
d04b97d
0abb51f
cd77e0e
afb44bd
580e1e3
a1dbd55
752c3ff
538bff5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,17 @@ | |
|
||
import six | ||
|
||
import warnings | ||
|
||
from nose.tools import assert_equal | ||
|
||
from matplotlib.cbook import MatplotlibDeprecationWarning | ||
from matplotlib.testing.decorators import knownfailureif | ||
from pylab import * | ||
with warnings.catch_warnings(): | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Does the warning makes any sense? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
|
||
def test_simple(): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,6 @@ | |
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup | ||
import matplotlib.pyplot as plt | ||
|
||
from pylab import * | ||
import numpy as np | ||
from matplotlib import patches, path, transforms | ||
|
||
from nose.tools import raises | ||
|
@@ -24,7 +22,7 @@ | |
@image_comparison(baseline_images=['clipping'], remove_text=True) | ||
def test_clipping(): | ||
t = np.arange(0.0, 2.0, 0.01) | ||
s = np.sin(2*pi*t) | ||
s = np.sin(2*np.pi*t) | ||
|
||
fig = plt.figure() | ||
ax = fig.add_subplot(111) | ||
|
@@ -101,16 +99,16 @@ def test_simplify_curve(): | |
def test_hatch(): | ||
fig = plt.figure() | ||
ax = fig.add_subplot(111) | ||
ax.add_patch(Rectangle((0, 0), 1, 1, fill=False, hatch="/")) | ||
ax.add_patch(plt.Rectangle((0, 0), 1, 1, fill=False, hatch="/")) | ||
ax.set_xlim((0.45, 0.55)) | ||
ax.set_ylim((0.45, 0.55)) | ||
|
||
@image_comparison(baseline_images=['fft_peaks'], remove_text=True) | ||
def test_fft_peaks(): | ||
fig = plt.figure() | ||
t = arange(65536) | ||
t = np.arange(65536) | ||
ax = fig.add_subplot(111) | ||
p1 = ax.plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) | ||
p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t))))) | ||
|
||
path = p1[0].get_path() | ||
transform = p1[0].get_transform() | ||
|
@@ -163,7 +161,7 @@ def test_start_with_moveto(): | |
@cleanup | ||
@raises(OverflowError) | ||
def test_throw_rendering_complexity_exceeded(): | ||
rcParams['path.simplify'] = False | ||
plt.rcParams['path.simplify'] = False | ||
xx = np.arange(200000) | ||
yy = np.random.rand(200000) | ||
yy[1000] = np.nan | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. The test has There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
@image_comparison(baseline_images=['clipper_edge'], remove_text=True) | ||
def test_clipper(): | ||
|
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.
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 tried
np.reciprocal