8000 Fix some test warnings by QuLogic · Pull Request #7336 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

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
Prev Previous commit
Next Next commit
Remove use of pylab from tests
Cherry-picked from master.
  • Loading branch information
jenshnielsen authored and QuLogic committed Oct 25, 2016
commit afb44bdadf0252c883f71274bbaa198060c38c1e
14 changes: 6 additions & 8 deletions lib/matplotlib/tests/test_simplification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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
< 6AAA /details-menu>
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.)


@image_comparison(baseline_images=['clipper_edge'], remove_text=True)
def test_clipper():
Expand Down
0