Skip to content

Commit 0e57a0b

Browse files
committed
Convert mpl_toolkits tests to pytest.
1 parent 194afed commit 0e57a0b

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

lib/matplotlib/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,9 +1531,6 @@ def _jupyter_nbextension_paths():
15311531
'matplotlib.tests.test_cycles',
15321532
'matplotlib.tests.test_preprocess_data',
15331533
'matplotlib.sphinxext.tests.test_tinypages',
1534-
'mpl_toolkits.tests.test_mplot3d',
1535-
'mpl_toolkits.tests.test_axes_grid1',
1536-
'mpl_toolkits.tests.test_axes_grid',
15371534
]
15381535

15391536

lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,3 @@ def get_demo_image():
155155
pad=0.1, borderpad=0.5, sep=5,
156156
frameon=False)
157157
ax.add_artist(asb)
158-
159-
160-
if __name__ == '__main__':
161-
import nose
162-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from nose.tools import assert_raises
1+
import pytest
2+
23
from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d
34
from matplotlib import cm
45
from matplotlib.testing.decorators import image_comparison, cleanup
@@ -222,7 +223,7 @@ def test_wireframe3dzerostrideraises():
222223
fig = plt.figure()
223224
ax = fig.add_subplot(111, projection='3d')
224225
X, Y, Z = axes3d.get_test_data(0.05)
225-
with assert_raises(ValueError):
226+
with pytest.raises(ValueError):
226227
ax.plot_wireframe(X, Y, Z, rstride=0, cstride=0)
227228

228229

@@ -231,9 +232,9 @@ def test_mixedsamplesraises():
231232
fig = plt.figure()
232233
ax = fig.add_subplot(111, projection='3d')
233234
X, Y, Z = axes3d.get_test_data(0.05)
234-
with assert_raises(ValueError):
235+
with pytest.raises(ValueError):
235236
ax.plot_wireframe(X, Y, Z, rstride=10, ccount=50)
236-
with assert_raises(ValueError):
237+
with pytest.raises(ValueError):
237238
ax.plot_surface(X, Y, Z, cstride=50, rcount=10)
238239

239240

@@ -316,16 +317,15 @@ def test_quiver3d_pivot_tail():
316317

317318
@image_comparison(baseline_images=['axes3d_labelpad'], extensions=['png'])
318319
def test_axes3d_labelpad():
319-
from nose.tools import assert_equal
320320
from matplotlib import rcParams
321321

322322
fig = plt.figure()
323323
ax = Axes3D(fig)
324324
# labelpad respects rcParams
325-
assert_equal(ax.xaxis.labelpad, rcParams['axes.labelpad'])
325+
assert ax.xaxis.labelpad == rcParams['axes.labelpad']
326326
# labelpad can be set in set_label
327327
ax.set_xlabel('X LABEL', labelpad=10)
328-
assert_equal(ax.xaxis.labelpad, 10)
328+
assert ax.xaxis.labelpad == 10
329329
ax.set_ylabel('Y LABEL')
330330
ax.set_zlabel('Z LABEL')
331331
# or manually
@@ -354,7 +354,8 @@ def test_plotsurface_1d_raises():
354354

355355
fig = plt.figure(figsize=(14,6))
356356
ax = fig.add_subplot(1, 2, 1, projection='3d')
357-
assert_raises(ValueError, ax.plot_surface, X, Y, z)
357+
with pytest.raises(ValueError):
358+
ax.plot_surface(X, Y, z)
358359

359360

360361
def _test_proj_make_M():
@@ -467,8 +468,3 @@ def test_lines_dists():
467468

468469
ax.set_xlim(-50, 150)
469470
ax.set_ylim(0, 300)
470-
471-
472-
if __name__ == '__main__':
473-
import nose
474-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)