[Scipy-svn] r3456 - trunk/scipy/ndimage/tests

scipy-svn@scip... scipy-svn@scip...
Mon Oct 22 11:13:25 CDT 2007


Author: stefan
Date: 2007-10-22 11:13:03 -0500 (Mon, 22 Oct 2007)
New Revision: 3456

Modified:
   trunk/scipy/ndimage/tests/test_ndimage.py
Log:
Protect against floating point roundoff.


Modified: trunk/scipy/ndimage/tests/test_ndimage.py
===================================================================
--- trunk/scipy/ndimage/tests/test_ndimage.py	2007-10-22 12:28:58 UTC (rev 3455)
+++ trunk/scipy/ndimage/tests/test_ndimage.py	2007-10-22 16:13:03 UTC (rev 3456)
@@ -2119,13 +2119,13 @@
         for order in range(0,6):
             for z in [2,[2,2]]:
                 arr = numpy.array(range(25)).reshape((5,5)).astype(float)
-                arr = ndimage.zoom(arr, z, order=2)
+                arr = ndimage.zoom(arr, z, order=order)
                 assert_equal(arr.shape,(10,10))
                 assert numpy.all(arr[-1,:] != 0)
-                assert numpy.all(arr[-1,:] >= 20)
-                assert numpy.all(arr[0,:] <= 5)
-                assert numpy.all(arr >= 0)
-                assert numpy.all(arr <= 24)
+                assert numpy.all(arr[-1,:] >= (20 - eps))
+                assert numpy.all(arr[0,:] <= (5 + eps))
+                assert numpy.all(arr >= (0 - eps))
+                assert numpy.all(arr <= (24 + eps))
 
     def test_zoom2(self):
         "zoom 2"



More information about the Scipy-svn mailing list