From: <as...@us...> - 2009-09-07 20:06:04
|
Revision: 7697 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7697&view=rev Author: astraw Date: 2009-09-07 20:05:54 +0000 (Mon, 07 Sep 2009) Log Message: ----------- test conversion: move old-style test to new-style test Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/test_cbook.py Removed Paths: ------------- trunk/matplotlib/test/test_matplotlib/TestCookbook.py Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2009-09-07 20:05:42 UTC (rev 7696) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2009-09-07 20:05:54 UTC (rev 7697) @@ -879,6 +879,7 @@ default_test_modules = [ 'matplotlib.tests.test_agg', 'matplotlib.tests.test_basic', + 'matplotlib.tests.test_cbook', 'matplotlib.tests.test_transforms', 'matplotlib.tests.test_axes', 'matplotlib.tests.test_dates', Added: trunk/matplotlib/lib/matplotlib/tests/test_cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_cbook.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/tests/test_cbook.py 2009-09-07 20:05:54 UTC (rev 7697) @@ -0,0 +1,14 @@ +import numpy as np +import matplotlib.cbook as cbook +from nose.tools import assert_equal + +def test_is_string_like(): + y = np.arange( 10 ) + assert_equal( cbook.is_string_like( y ), False ) + y.shape = 10, 1 + assert_equal( cbook.is_string_like( y ), False ) + y.shape = 1, 10 + assert_equal( cbook.is_string_like( y ), False ) + + assert cbook.is_string_like( "hello world" ) + assert_equal( cbook.is_string_like(10), False ) Deleted: trunk/matplotlib/test/test_matplotlib/TestCookbook.py =================================================================== --- trunk/matplotlib/test/test_matplotlib/TestCookbook.py 2009-09-07 20:05:42 UTC (rev 7696) +++ trunk/matplotlib/test/test_matplotlib/TestCookbook.py 2009-09-07 20:05:54 UTC (rev 7697) @@ -1,59 +0,0 @@ -#======================================================================= -"""The Cookbook unit-test class implementation.""" -#======================================================================= - -from mplTest import * - -#======================================================================= -# Add import modules below. -import matplotlib -matplotlib.use( "Agg", warn = False ) - -import numpy as npy -import matplotlib.cbook as cbook -# -#======================================================================= - -#======================================================================= -class TestCookbook( MplTestCase ): - """Cookbook unit test class.""" - - # 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.""" - pass - - #-------------------------------------------------------------------- - def tearDown( self ): - """Clean-up any generated files here.""" - pass - - #-------------------------------------------------------------------- - def test_is_string_like( self ): - """Test the 'is_string_like cookbook' function.""" - y = npy.arange( 10 ) - self.failUnless( cbook.is_string_like( y ) == False ) - y.shape = 10, 1 - self.failUnless( cbook.is_string_like( y ) == False ) - y.shape = 1, 10 - self.failUnless( cbook.is_string_like( y ) == False ) - - - self.failUnless( cbook.is_string_like( "hello world" ) ) - self.failUnless( cbook.is_string_like(10) == False ) - - #-------------------------------------------------------------------- - #TODO: More cookbook tests - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |