From: <as...@us...> - 2009-09-07 20:01:59
|
Revision: 7682 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7682&view=rev Author: astraw Date: 2009-09-07 20:01:49 +0000 (Mon, 07 Sep 2009) Log Message: ----------- test conversion: move old-style test to new-style test Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/tests/test_dates.py trunk/matplotlib/test/test_matplotlib/TestTickers.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/RRuleLocator_bounds.png Removed Paths: ------------- trunk/matplotlib/test/test_matplotlib/baseline/TestTickers/RRuleLocator_bounds.png Copied: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/RRuleLocator_bounds.png (from rev 7681, trunk/matplotlib/test/test_matplotlib/baseline/TestTickers/RRuleLocator_bounds.png) =================================================================== (Binary files differ) Modified: trunk/matplotlib/lib/matplotlib/tests/test_dates.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_dates.py 2009-09-07 20:01:33 UTC (rev 7681) +++ trunk/matplotlib/lib/matplotlib/tests/test_dates.py 2009-09-07 20:01:49 UTC (rev 7682) @@ -83,6 +83,36 @@ ax.xaxis.set_major_locator(DayLocator()) assert_raises(RuntimeError, fig.savefig, 'junk.png') +@image_comparison(baseline_images=['RRuleLocator_bounds']) +def test_RRuleLocator(): + import pylab + import matplotlib.dates as mpldates + import matplotlib.testing.jpl_units as units + from datetime import datetime + import dateutil + units.register() + + # This will cause the RRuleLocator to go out of bounds when it tries + # to add padding to the limits, so we make sure it caps at the correct + # boundary values. + t0 = datetime( 1000, 1, 1 ) + tf = datetime( 6000, 1, 1 ) + + fig = pylab.figure() + ax = pylab.subplot( 111 ) + ax.set_autoscale_on( True ) + ax.plot( [t0, tf], [0.0, 1.0], marker='o' ) + + rrule = mpldates.rrulewrapper( dateutil.rrule.YEARLY, interval=500 ) + locator = mpldates.RRuleLocator( rrule ) + ax.xaxis.set_major_locator( locator ) + ax.xaxis.set_major_formatter( mpldates.AutoDateFormatter(locator) ) + + ax.autoscale_view() + fig.autofmt_xdate() + + fig.savefig( 'RRuleLocator_bounds' ) + if __name__=='__main__': import nose nose.runmodule(argv=['-s','--with-doctest'], exit=False) Modified: trunk/matplotlib/test/test_matplotlib/TestTickers.py =================================================================== --- trunk/matplotlib/test/test_matplotlib/TestTickers.py 2009-09-07 20:01:33 UTC (rev 7681) +++ trunk/matplotlib/test/test_matplotlib/TestTickers.py 2009-09-07 20:01:49 UTC (rev 7682) @@ -46,33 +46,6 @@ pass #-------------------------------------------------------------------- - def test_RRuleLocator( self ): - """Test RRuleLocator""" - fname = self.outFile( "RRuleLocator_bounds.png" ) - - # This will cause the RRuleLocator to go out of bounds when it tries - # to add padding to the limits, so we make sure it caps at the correct - # boundary values. - t0 = datetime( 1000, 1, 1 ) - tf = datetime( 6000, 1, 1 ) - - fig = pylab.figure() - ax = pylab.subplot( 111 ) - ax.set_autoscale_on( True ) - ax.plot( [t0, tf], [0.0, 1.0], marker='o' ) - - rrule = mpldates.rrulewrapper( dateutil.rrule.YEARLY, interval=500 ) - locator = mpldates.RRuleLocator( rrule ) - ax.xaxis.set_major_locator( locator ) - ax.xaxis.set_major_formatter( mpldates.AutoDateFormatter(locator) ) - - ax.autoscale_view() - fig.autofmt_xdate() - - fig.savefig( fname ) - self.checkImage( fname ) - - #-------------------------------------------------------------------- def test_DateFormatter( self ): """Test DateFormatter""" Deleted: trunk/matplotlib/test/test_matplotlib/baseline/TestTickers/RRuleLocator_bounds.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |