1- from nose .tools import assert_raises
1+ import pytest
2+
23from mpl_toolkits .mplot3d import Axes3D , axes3d , proj3d
34from matplotlib import cm
45from 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' ])
318319def 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
360361def _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