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

Skip to content

Commit 597da3a

Browse files
committed
test conversion: move old-style test to new-style test
svn path=/trunk/matplotlib/; revision=7692
1 parent 32282ac commit 597da3a

4 files changed

Lines changed: 29 additions & 34 deletions

File tree

test/test_plots/baseline/TestPolar/polar_wrap_180.png renamed to lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.png

File renamed without changes.

test/test_plots/baseline/TestPolar/polar_wrap_360.png renamed to lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.png

File renamed without changes.

lib/matplotlib/tests/test_axes.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,32 @@ def test_const_xy():
259259
pylab.plot( np.ones( (10,) ), np.ones( (10,) ), 'o' )
260260

261261
fig.savefig( 'const_xy' )
262+
263+
@image_comparison(baseline_images=['polar_wrap_180',
264+
'polar_wrap_360',
265+
])
266+
def test_polar_wrap():
267+
"""Test polar plots where data crosses 0 degrees."""
268+
269+
D2R = np.pi / 180.0
270+
271+
fig = pylab.figure()
272+
273+
#NOTE: resolution=1 really should be the default
274+
pylab.subplot( 111, polar=True, resolution=1 )
275+
pylab.polar( [179*D2R, -179*D2R], [0.2, 0.1], "b.-" )
276+
pylab.polar( [179*D2R, 181*D2R], [0.2, 0.1], "g.-" )
277+
pylab.rgrids( [0.05, 0.1, 0.15, 0.2, 0.25, 0.3] )
278+
279+
fig.savefig( 'polar_wrap_180' )
280+
281+
fig = pylab.figure()
282+
283+
#NOTE: resolution=1 really should be the default
284+
pylab.subplot( 111, polar=True, resolution=1 )
285+
pylab.polar( [2*D2R, -2*D2R], [0.2, 0.1], "b.-" )
286+
pylab.polar( [2*D2R, 358*D2R], [0.2, 0.1], "g.-" )
287+
pylab.polar( [358*D2R, 2*D2R], [0.2, 0.1], "r.-" )
288+
pylab.rgrids( [0.05, 0.1, 0.15, 0.2, 0.25, 0.3] )
289+
290+
fig.savefig( 'polar_wrap_360' )

test/test_plots/TestPolar.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,6 @@ def tearDown( self ):
4040
"""Clean-up any generated files here."""
4141
pass
4242

43-
#--------------------------------------------------------------------
44-
def test_polar_wrap( self ):
45-
"""Test polar plots where data crosses 0 degrees."""
46-
47-
fname = self.outFile( "polar_wrap_180.png" )
48-
49-
D2R = npy.pi / 180.0
50-
51-
fig = pylab.figure()
52-
53-
#NOTE: resolution=1 really should be the default
54-
pylab.subplot( 111, polar=True, resolution=1 )
55-
pylab.polar( [179*D2R, -179*D2R], [0.2, 0.1], "b.-" )
56-
pylab.polar( [179*D2R, 181*D2R], [0.2, 0.1], "g.-" )
57-
pylab.rgrids( [0.05, 0.1, 0.15, 0.2, 0.25, 0.3] )
58-
59-
fig.savefig( fname )
60-
self.checkImage( fname )
61-
62-
63-
fname = self.outFile( "polar_wrap_360.png" )
64-
65-
fig = pylab.figure()
66-
67-
#NOTE: resolution=1 really should be the default
68-
pylab.subplot( 111, polar=True, resolution=1 )
69-
pylab.polar( [2*D2R, -2*D2R], [0.2, 0.1], "b.-" )
70-
pylab.polar( [2*D2R, 358*D2R], [0.2, 0.1], "g.-" )
71-
pylab.polar( [358*D2R, 2*D2R], [0.2, 0.1], "r.-" )
72-
pylab.rgrids( [0.05, 0.1, 0.15, 0.2, 0.25, 0.3] )
73-
74-
fig.savefig( fname )
75-
self.checkImage( fname )
76-
7743
#--------------------------------------------------------------------
7844
def test_polar_units( self ):
7945
"""Test polar plots with unitized data."""

0 commit comments

Comments
 (0)