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

Skip to content

Commit 3cb7787

Browse files
committed
Remove use of pylab from tests
1 parent 8ff0cc2 commit 3cb7787

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

lib/matplotlib/tests/test_simplification.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup
99
import matplotlib.pyplot as plt
1010

11-
from pylab import *
1211
from matplotlib import patches, path, transforms
1312

1413
from nose.tools import raises
@@ -23,7 +22,7 @@
2322
@image_comparison(baseline_images=['clipping'], remove_text=True)
2423
def test_clipping():
2524
t = np.arange(0.0, 2.0, 0.01)
26-
s = np.sin(2*pi*t)
25+
s = np.sin(2*np.pi*t)
2726

2827
fig = plt.figure()
2928
ax = fig.add_subplot(111)
@@ -100,16 +99,16 @@ def test_simplify_curve():
10099
def test_hatch():
101100
fig = plt.figure()
102101
ax = fig.add_subplot(111)
103-
ax.add_patch(Rectangle((0, 0), 1, 1, fill=False, hatch="/"))
102+
ax.add_patch(plt.Rectangle((0, 0), 1, 1, fill=False, hatch="/"))
104103
ax.set_xlim((0.45, 0.55))
105104
ax.set_ylim((0.45, 0.55))
106105

107106
@image_comparison(baseline_images=['fft_peaks'], remove_text=True)
108107
def test_fft_peaks():
109108
fig = plt.figure()
110-
t = arange(65536)
109+
t = np.arange(65536)
111110
ax = fig.add_subplot(111)
112-
p1 = ax.plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
111+
p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t)))))
113112

114113
path = p1[0].get_path()
115114
transform = p1[0].get_transform()
@@ -162,7 +161,7 @@ def test_start_with_moveto():
162161
@cleanup
163162
@raises(OverflowError)
164163
def test_throw_rendering_complexity_exceeded():
165-
rcParams['path.simplify'] = False
164+
plt.rcParams['path.simplify'] = False
166165
xx = np.arange(200000)
167166
yy = np.random.rand(200000)
168167
yy[1000] = np.nan
@@ -172,7 +171,7 @@ def test_throw_rendering_complexity_exceeded():
172171
try:
173172
fig.savefig(io.BytesIO())
174173
finally:
175-
rcParams['path.simplify'] = True
174+
plt.rcParams['path.simplify'] = True
176175

177176
@image_comparison(baseline_images=['clipper_edge'], remove_text=True)
178177
def test_clipper():

0 commit comments

Comments
 (0)