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

Skip to content

Commit f3144f3

Browse files
committed
test conversion: move old-style test to new-style test
svn path=/trunk/matplotlib/; revision=7694
1 parent 4819d22 commit f3144f3

3 files changed

Lines changed: 22 additions & 22 deletions

File tree

test/test_plots/baseline/TestSpan/axvspan_epoch.png renamed to lib/matplotlib/tests/baseline_images/test_axes/axvspan_epoch.png

File renamed without changes.

lib/matplotlib/tests/test_axes.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,25 @@ def test_polar_units():
312312
# polar( x2, y2, color = "green" )
313313

314314
fig.savefig( 'polar_units' )
315+
316+
@image_comparison(baseline_images=['axvspan_epoch'])
317+
def test_axvspan_epoch():
318+
"""Test the axvspan method with Epochs."""
319+
from datetime import datetime
320+
import matplotlib.testing.jpl_units as units
321+
units.register()
322+
323+
# generate some data
324+
t0 = units.Epoch( "ET", dt=datetime(2009, 1, 20) )
325+
tf = units.Epoch( "ET", dt=datetime(2009, 1, 21) )
326+
327+
dt = units.Duration( "ET", units.day.convert( "sec" ) )
328+
329+
fig = pylab.figure()
330+
331+
pylab.axvspan( t0, tf, facecolor="blue", alpha=0.25 )
332+
333+
ax = pylab.gca()
334+
ax.set_xlim( t0 - 5.0*dt, tf + 5.0*dt )
335+
336+
fig.savefig( 'axvspan_epoch' )

test/test_plots/TestSpan.py

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

44-
#--------------------------------------------------------------------
45-
def test_axvspan_epoch( self ):
46-
"""Test the axvspan method with Epochs."""
47-
48-
fname = self.outFile( "axvspan_epoch.png" )
49-
50-
# generate some data
51-
t0 = units.Epoch( "ET", dt=datetime(2009, 1, 20) )
52-
tf = units.Epoch( "ET", dt=datetime(2009, 1, 21) )
53-
54-
dt = units.Duration( "ET", units.day.convert( "sec" ) )
55-
56-
fig = pylab.figure()
57-
58-
pylab.axvspan( t0, tf, facecolor="blue", alpha=0.25 )
59-
60-
ax = pylab.gca()
61-
ax.set_xlim( t0 - 5.0*dt, tf + 5.0*dt )
62-
63-
fig.savefig( fname )
64-
self.checkImage( fname )
65-
6644
#--------------------------------------------------------------------
6745
def test_axhspan_epoch( self ):
6846
"""Test the axhspan method with Epochs."""

0 commit comments

Comments
 (0)