From: <as...@us...> - 2009-09-06 22:47:20
|
Revision: 7668 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7668&view=rev Author: astraw Date: 2009-09-06 22:47:08 +0000 (Sun, 06 Sep 2009) Log Message: ----------- testing: convert some JPL units tests to simple nose tests Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/testing/jpl_units/UnitDblConverter.py trunk/matplotlib/lib/matplotlib/testing/jpl_units/__init__.py trunk/matplotlib/setup.py Removed Paths: ------------- trunk/matplotlib/test/test_matplotlib/TestAxes.py Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2009-09-06 22:46:52 UTC (rev 7667) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2009-09-06 22:47:08 UTC (rev 7668) @@ -879,6 +879,7 @@ default_test_modules = [ 'matplotlib.tests.test_basic', 'matplotlib.tests.test_transforms', + 'matplotlib.tests.test_axes', 'matplotlib.tests.test_spines', ] Modified: trunk/matplotlib/lib/matplotlib/testing/jpl_units/UnitDblConverter.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/jpl_units/UnitDblConverter.py 2009-09-06 22:46:52 UTC (rev 7667) +++ trunk/matplotlib/lib/matplotlib/testing/jpl_units/UnitDblConverter.py 2009-09-06 22:47:08 UTC (rev 7668) @@ -66,7 +66,7 @@ label information. """ # Delay-load due to circular dependencies. - import mplTest.units as U + import matplotlib.testing.jpl_units as U # Check to see if the value used for units is a string unit value # or an actual instance of a UnitDbl so that we can use the unit @@ -105,7 +105,7 @@ - Returns the value parameter converted to floats. """ # Delay-load due to circular dependencies. - import mplTest.units as U + import matplotlib.testing.jpl_units as U isNotUnitDbl = True Modified: trunk/matplotlib/lib/matplotlib/testing/jpl_units/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/jpl_units/__init__.py 2009-09-06 22:46:52 UTC (rev 7667) +++ trunk/matplotlib/lib/matplotlib/testing/jpl_units/__init__.py 2009-09-06 22:47:08 UTC (rev 7668) @@ -30,15 +30,15 @@ """ #======================================================================= -from mplTest.units.Duration import Duration -from mplTest.units.Epoch import Epoch -from mplTest.units.UnitDbl import UnitDbl +from Duration import Duration +from Epoch import Epoch +from UnitDbl import UnitDbl -from mplTest.units.StrConverter import StrConverter -from mplTest.units.EpochConverter import EpochConverter -from mplTest.units.UnitDblConverter import UnitDblConverter +from StrConverter import StrConverter +from EpochConverter import EpochConverter +from UnitDblConverter import UnitDblConverter -from mplTest.units.UnitDblFormatter import UnitDblFormatter +from UnitDblFormatter import UnitDblFormatter #======================================================================= Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2009-09-06 22:46:52 UTC (rev 7667) +++ trunk/matplotlib/setup.py 2009-09-06 22:47:08 UTC (rev 7668) @@ -51,6 +51,7 @@ 'matplotlib.backends', 'matplotlib.projections', 'matplotlib.testing', + 'matplotlib.testing.jpl_units', 'matplotlib.tests', # 'matplotlib.toolkits', 'mpl_toolkits', Deleted: trunk/matplotlib/test/test_matplotlib/TestAxes.py =================================================================== --- trunk/matplotlib/test/test_matplotlib/TestAxes.py 2009-09-06 22:46:52 UTC (rev 7667) +++ trunk/matplotlib/test/test_matplotlib/TestAxes.py 2009-09-06 22:47:08 UTC (rev 7668) @@ -1,102 +0,0 @@ -#======================================================================= -"""The Axes unit-test class implementation.""" -#======================================================================= - -from mplTest import MplTestCase, units -from matplotlib.testing.decorators import knownfailureif - -#======================================================================= -# Add import modules below. -import matplotlib -matplotlib.use( "Agg", warn = False ) - -import pylab -import numpy as npy -from datetime import datetime -# -#======================================================================= - -#======================================================================= -class TestAxes( MplTestCase ): - """Test the various axes non-plotting methods.""" - - # Uncomment any appropriate tags - tags = [ - # 'gui', # requires the creation of a gui window - 'agg', # uses agg in the backend - 'agg-only', # uses only agg in the backend - # 'wx', # uses wx in the backend - # 'qt', # uses qt in the backend - # 'ps', # uses the postscript backend - # 'units', # uses units in the test - 'PIL', # uses PIL for image comparison - ] - - #-------------------------------------------------------------------- - def setUp( self ): - """Setup any data needed for the unit test.""" - units.register() - - #-------------------------------------------------------------------- - def tearDown( self ): - """Clean-up any generated files here.""" - pass - - #-------------------------------------------------------------------- - @knownfailureif('indeterminate', "Fails due to SF bug 2850075") - def test_empty_datetime( self ): - """Test plotting empty axes with dates along one axis.""" - fname = self.outFile( "empty_datetime.png" ) - - t0 = datetime(2009, 1, 20) - tf = datetime(2009, 1, 21) - - fig = pylab.figure() - pylab.axvspan( t0, tf, facecolor="blue", alpha=0.25 ) - fig.autofmt_xdate() - - fig.savefig( fname ) - self.checkImage( fname ) - - #-------------------------------------------------------------------- - def test_formatter_ticker( self ): - """Test Some formatter and ticker issues.""" - - # This essentially test to see if user specified labels get overwritten - # by the auto labeler functionality of the axes. - xdata = [ x*units.sec for x in range(10) ] - ydata1 = [ (1.5*y - 0.5)*units.km for y in range(10) ] - ydata2 = [ (1.75*y - 1.0)*units.km for y in range(10) ] - - fname = self.outFile( "formatter_ticker_001.png" ) - fig = pylab.figure() - ax = pylab.subplot( 111 ) - ax.set_xlabel( "x-label 001" ) - fig.savefig( fname ) - self.checkImage( fname ) - - fname = self.outFile( "formatter_ticker_002.png" ) - ax.plot( xdata, ydata1, color='blue', xunits="sec" ) - fig.savefig( fname ) - self.checkImage( fname ) - - fname = self.outFile( "formatter_ticker_003.png" ) - ax.set_xlabel( "x-label 003" ) - fig.savefig( fname ) - self.checkImage( fname ) - - fname = self.outFile( "formatter_ticker_004.png" ) - ax.plot( xdata, ydata2, color='green', xunits="hour" ) - ax.set_xlabel( "x-label 004" ) - fig.savefig( fname ) - self.checkImage( fname ) - - # See SF bug 2846058 - # https://sourceforge.net/tracker/?func=detail&aid=2846058&group_id=80706&atid=560720 - fname = self.outFile( "formatter_ticker_005.png" ) - ax.set_xlabel( "x-label 005" ) - ax.autoscale_view() - fig.savefig( fname ) - self.checkImage( fname ) - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |