[Scipy-svn] r7058 - branches/0.9.x/scipy/interpolate/tests

scipy-svn at scipy.org scipy-svn at scipy.org
Sun Jan 16 10:02:03 EST 2011


Author: rgommers
Date: 2011-01-16 09:01:59 -0600 (Sun, 16 Jan 2011)
New Revision: 7058

Modified:
   branches/0.9.x/scipy/interpolate/tests/test_rbf.py
Log:
TST: silence floating point test noise in interpolate.

(backport of r7035)

Modified: branches/0.9.x/scipy/interpolate/tests/test_rbf.py
===================================================================
--- branches/0.9.x/scipy/interpolate/tests/test_rbf.py	2011-01-16 09:05:37 UTC (rev 7057)
+++ branches/0.9.x/scipy/interpolate/tests/test_rbf.py	2011-01-16 15:01:59 UTC (rev 7058)
@@ -2,6 +2,7 @@
 # Created by John Travers, Robert Hetland, 2007
 """ Test functions for rbf module """
 
+import numpy as np
 from numpy.testing import assert_, assert_array_almost_equal, assert_almost_equal
 from numpy import linspace, sin, random, exp, allclose
 from scipy.interpolate.rbf import Rbf
@@ -40,10 +41,14 @@
     assert_array_almost_equal(di, d)
 
 def test_rbf_interpolation():
-    for function in FUNCTIONS:
-        yield check_rbf1d_interpolation, function
-        yield check_rbf2d_interpolation, function
-        yield check_rbf3d_interpolation, function
+    olderr = np.seterr(all="ignore")
+    try:
+        for function in FUNCTIONS:
+            yield check_rbf1d_interpolation, function
+            yield check_rbf2d_interpolation, function
+            yield check_rbf3d_interpolation, function
+    finally:
+        np.seterr(**olderr)
 
 def check_rbf1d_regularity(function, atol):
     """Check that the Rbf function approximates a smooth function well away
@@ -71,8 +76,12 @@
         'thin-plate': 0.1,
         'linear': 0.2
     }
-    for function in FUNCTIONS:
-        yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2)
+    olderr = np.seterr(all="ignore")
+    try:
+        for function in FUNCTIONS:
+            yield check_rbf1d_regularity, function, tolerances.get(function, 1e-2)
+    finally:
+        np.seterr(**olderr)
 
 def test_default_construction():
     """Check that the Rbf class can be constructed with the default




More information about the Scipy-svn mailing list