From: <as...@us...> - 2009-09-06 01:43:48
|
Revision: 7649 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7649&view=rev Author: astraw Date: 2009-09-06 01:43:40 +0000 (Sun, 06 Sep 2009) Log Message: ----------- testing: convert function names to MPL coding standard Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/compare.py trunk/matplotlib/test/mplTest/MplTestCase.py Modified: trunk/matplotlib/lib/matplotlib/testing/compare.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/compare.py 2009-09-06 01:43:29 UTC (rev 7648) +++ trunk/matplotlib/lib/matplotlib/testing/compare.py 2009-09-06 01:43:40 UTC (rev 7649) @@ -11,12 +11,12 @@ #======================================================================= __all__ = [ - 'compareFloat', - 'compareImages', + 'compare_float', + 'compare_images', ] #----------------------------------------------------------------------- -def compareFloat( expected, actual, relTol = None, absTol = None ): +def compare_float( expected, actual, relTol = None, absTol = None ): """Fail if the floating point values are not close enough, with the givem message. @@ -72,7 +72,7 @@ return None #----------------------------------------------------------------------- -def compareImages( expected, actual, tol ): +def compare_images( expected, actual, tol ): '''Compare two image files - not the greatest, but fast and good enough. = EXAMPLE @@ -80,7 +80,7 @@ # img1 = "./baseline/plot.png" # img2 = "./output/plot.png" # - # compareImage( img1, img2, 0.001 ): + # compare_images( img1, img2, 0.001 ): = INPUT VARIABLES - expected The filename of the expected image. @@ -116,7 +116,7 @@ else: diff_image = os.path.join(os.path.dirname(actual), 'failed-diff-'+os.path.basename(actual)) - saveDiffImage( expected, actual, diff_image ) + save_diff_image( expected, actual, diff_image ) msg = " Error: Image files did not match.\n" \ " RMS Value: " + str( rms / 10000.0 ) + "\n" \ @@ -126,7 +126,7 @@ " Tolerance: " + str( tol ) + "\n" return msg -def saveDiffImage( expected, actual, output ): +def save_diff_image( expected, actual, output ): from PIL import Image expectedImage = np.array(Image.open( expected ).convert("RGB")).astype(np.float) actualImage = np.array(Image.open( actual ).convert("RGB")).astype(np.float) Modified: trunk/matplotlib/test/mplTest/MplTestCase.py =================================================================== --- trunk/matplotlib/test/mplTest/MplTestCase.py 2009-09-06 01:43:29 UTC (rev 7648) +++ trunk/matplotlib/test/mplTest/MplTestCase.py 2009-09-06 01:43:40 UTC (rev 7649) @@ -51,7 +51,7 @@ baselineImage = self.baseFile( basename ) - errorMessage = compare.compareImages( baselineImage, actualImage, tol ) + errorMessage = compare.compare_images( baselineImage, actualImage, tol ) if errorMessage: self.fail( msg + "\n" + errorMessage ) @@ -108,7 +108,7 @@ You can specify a relative tolerance, absolute tolerance, or both. """ - errorMessage = compare.compareFloat( expected, actual, relTol, absTol ) + errorMessage = compare.compare_float( expected, actual, relTol, absTol ) if errorMessage: self.fail( msg + "\n" + errorMessage ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |