[Scipy-svn] r7062 - branches/0.9.x/scipy/optimize/tests

scipy-svn at scipy.org scipy-svn at scipy.org
Sun Jan 16 10:19:31 EST 2011


Author: rgommers
Date: 2011-01-16 09:19:08 -0600 (Sun, 16 Jan 2011)
New Revision: 7062

Modified:
   branches/0.9.x/scipy/optimize/tests/test_minpack.py
   branches/0.9.x/scipy/optimize/tests/test_optimize.py
Log:
TST: silence test noise from optimize module.

(backport of r7039)

Modified: branches/0.9.x/scipy/optimize/tests/test_minpack.py
===================================================================
--- branches/0.9.x/scipy/optimize/tests/test_minpack.py	2011-01-16 15:17:43 UTC (rev 7061)
+++ branches/0.9.x/scipy/optimize/tests/test_minpack.py	2011-01-16 15:19:08 UTC (rev 7062)
@@ -13,9 +13,9 @@
 
 class ReturnShape(object):
     """This class exists to create a callable that does not have a 'func_name' attribute.
-    
+
     __init__ takes the argument 'shape', which should be a tuple of ints.  When an instance
-    it called with a single argument 'x', it returns numpy.ones(shape). 
+    it called with a single argument 'x', it returns numpy.ones(shape).
     """
     def __init__(self, shape):
         self.shape = shape
@@ -221,7 +221,7 @@
 
 class TestFixedPoint(TestCase):
 
-    def text_scalar_trivial(self):
+    def test_scalar_trivial(self):
         """f(x) = 2x; fixed point should be x=0"""
         def func(x):
             return 2.0*x
@@ -249,7 +249,11 @@
         def func(x):
             return 2.0*x
         x0 = [0.3, 0.15]
-        x = fixed_point(func, x0)
+        olderr = np.seterr(all='ignore')
+        try:
+            x = fixed_point(func, x0)
+        finally:
+            np.seterr(**olderr)
         assert_almost_equal(x, [0.0, 0.0])
 
     def test_array_basic1(self):
@@ -258,7 +262,11 @@
             return c * x**2
         c = array([0.75, 1.0, 1.25])
         x0 = [1.1, 1.15, 0.9]
-        x = fixed_point(func, x0, args=(c,))
+        olderr = np.seterr(all='ignore')
+        try:
+            x = fixed_point(func, x0, args=(c,))
+        finally:
+            np.seterr(**olderr)
         assert_almost_equal(x, 1.0/c)
 
     def test_array_basic2(self):

Modified: branches/0.9.x/scipy/optimize/tests/test_optimize.py
===================================================================
--- branches/0.9.x/scipy/optimize/tests/test_optimize.py	2011-01-16 15:17:43 UTC (rev 7061)
+++ branches/0.9.x/scipy/optimize/tests/test_optimize.py	2011-01-16 15:19:08 UTC (rev 7062)
@@ -67,7 +67,6 @@
         err = abs(self.func(params) - self.func(self.solution))
         #print "CG: Difference is: " + str(err)
         assert_(err < 1e-6)
-        print self.funccalls, self.gradcalls
 
         # Ensure that function call counts are 'known good'; these are from
         # Scipy 0.7.0. Don't allow them to increase.




More information about the Scipy-svn mailing list