[Scipy-svn] r6790 - trunk/scipy/interpolate/tests

scipy-svn@scip... scipy-svn@scip...
Sun Sep 12 16:18:42 CDT 2010


Author: warren.weckesser
Date: 2010-09-12 16:18:42 -0500 (Sun, 12 Sep 2010)
New Revision: 6790

Modified:
   trunk/scipy/interpolate/tests/test_fitpack.py
   trunk/scipy/interpolate/tests/test_interpnd.py
   trunk/scipy/interpolate/tests/test_interpolate.py
   trunk/scipy/interpolate/tests/test_ndgriddata.py
   trunk/scipy/interpolate/tests/test_polyint.py
   trunk/scipy/interpolate/tests/test_rbf.py
   trunk/scipy/interpolate/tests/test_regression.py
Log:
TST: interpolate: Don't use 'import *'. Don't use plain 'assert'.

Modified: trunk/scipy/interpolate/tests/test_fitpack.py
===================================================================
--- trunk/scipy/interpolate/tests/test_fitpack.py	2010-09-12 21:17:28 UTC (rev 6789)
+++ trunk/scipy/interpolate/tests/test_fitpack.py	2010-09-12 21:18:42 UTC (rev 6790)
@@ -12,7 +12,8 @@
 """
 #import libwadpy
 
-from numpy.testing import *
+from numpy.testing import assert_equal, assert_almost_equal, assert_array_equal, \
+        assert_array_almost_equal, TestCase, run_module_suite
 from numpy import array, diff, shape
 from scipy.interpolate.fitpack2 import UnivariateSpline, LSQBivariateSpline, \
     SmoothBivariateSpline, RectBivariateSpline

Modified: trunk/scipy/interpolate/tests/test_interpnd.py
===================================================================
--- trunk/scipy/interpolate/tests/test_interpnd.py	2010-09-12 21:17:28 UTC (rev 6789)
+++ trunk/scipy/interpolate/tests/test_interpnd.py	2010-09-12 21:18:42 UTC (rev 6790)
@@ -1,5 +1,6 @@
 import numpy as np
-from numpy.testing import *
+from numpy.testing import assert_equal, assert_allclose, assert_almost_equal, \
+        run_module_suite
 
 import scipy.interpolate.interpnd as interpnd
 import scipy.spatial.qhull as qhull

Modified: trunk/scipy/interpolate/tests/test_interpolate.py
===================================================================
--- trunk/scipy/interpolate/tests/test_interpolate.py	2010-09-12 21:17:28 UTC (rev 6789)
+++ trunk/scipy/interpolate/tests/test_interpolate.py	2010-09-12 21:18:42 UTC (rev 6790)
@@ -1,4 +1,6 @@
-from numpy.testing import *
+from numpy.testing import assert_, assert_equal, assert_almost_equal, \
+        assert_array_almost_equal, assert_raises, assert_array_equal, \
+        dec, TestCase, run_module_suite
 from numpy import mgrid, pi, sin, ogrid, poly1d, linspace
 import numpy as np
 
@@ -80,11 +82,11 @@
         constructor.
         """
 
-        assert interp1d(self.x10, self.y10).copy
-        assert not interp1d(self.x10, self.y10, copy=False).copy
-        assert interp1d(self.x10, self.y10).bounds_error
-        assert not interp1d(self.x10, self.y10, bounds_error=False).bounds_error
-        assert np.isnan(interp1d(self.x10, self.y10).fill_value)
+        assert_(interp1d(self.x10, self.y10).copy)
+        assert_(not interp1d(self.x10, self.y10, copy=False).copy)
+        assert_(interp1d(self.x10, self.y10).bounds_error)
+        assert_(not interp1d(self.x10, self.y10, bounds_error=False).bounds_error)
+        assert_(np.isnan(interp1d(self.x10, self.y10).fill_value))
         assert_equal(
             interp1d(self.x10, self.y10, fill_value=3.0).fill_value,
             3.0,
@@ -213,7 +215,7 @@
         y = np.arange(10).astype(np.int_)
         c = interp1d(x, y, kind=kind, fill_value=np.nan, bounds_error=False)
         yi = c(x - 1)
-        assert np.isnan(yi[0])
+        assert_(np.isnan(yi[0]))
         assert_array_almost_equal(yi, np.r_[np.nan, y[:-1]])
 
     def test_bounds(self):
@@ -234,7 +236,7 @@
         )
 
         # Scalar input -> 0-dim scalar array output
-        assert isinstance(interp10(1.2), np.ndarray)
+        assert_(isinstance(interp10(1.2), np.ndarray))
         assert_equal(interp10(1.2).shape, ())
 
         # Multidimensional outputs.

Modified: trunk/scipy/interpolate/tests/test_ndgriddata.py
===================================================================
--- trunk/scipy/interpolate/tests/test_ndgriddata.py	2010-09-12 21:17:28 UTC (rev 6789)
+++ trunk/scipy/interpolate/tests/test_ndgriddata.py	2010-09-12 21:18:42 UTC (rev 6790)
@@ -1,5 +1,6 @@
 import numpy as np
-from numpy.testing import *
+from numpy.testing import assert_equal, assert_array_equal, assert_allclose, \
+        run_module_suite
 
 from scipy.interpolate import griddata
 

Modified: trunk/scipy/interpolate/tests/test_polyint.py
===================================================================
--- trunk/scipy/interpolate/tests/test_polyint.py	2010-09-12 21:17:28 UTC (rev 6789)
+++ trunk/scipy/interpolate/tests/test_polyint.py	2010-09-12 21:18:42 UTC (rev 6790)
@@ -1,5 +1,6 @@
 
-from numpy.testing import *
+from numpy.testing import assert_almost_equal, assert_array_equal, \
+        TestCase, run_module_suite
 from scipy.interpolate import KroghInterpolator, krogh_interpolate, \
         BarycentricInterpolator, barycentric_interpolate, \
         PiecewisePolynomial, piecewise_polynomial_interpolate, \

Modified: trunk/scipy/interpolate/tests/test_rbf.py
===================================================================
--- trunk/scipy/interpolate/tests/test_rbf.py	2010-09-12 21:17:28 UTC (rev 6789)
+++ trunk/scipy/interpolate/tests/test_rbf.py	2010-09-12 21:18:42 UTC (rev 6790)
@@ -2,9 +2,8 @@
 # Created by John Travers, Robert Hetland, 2007
 """ Test functions for rbf module """
 
-import numpy as np
-from numpy.testing import assert_array_almost_equal, assert_almost_equal
-from numpy import linspace, sin, random, exp, log10, allclose
+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
 
 FUNCTIONS = ('multiquadric', 'inverse multiquadric', 'gaussian',
@@ -60,7 +59,7 @@
     #plt.title(function)
     #plt.show()
     msg = "abs-diff: %f" % abs(yi - sin(xi)).max()
-    assert allclose(yi, sin(xi), atol=atol), msg
+    assert_(allclose(yi, sin(xi), atol=atol), msg)
 
 def test_rbf_regularity():
     tolerances = {

Modified: trunk/scipy/interpolate/tests/test_regression.py
===================================================================
--- trunk/scipy/interpolate/tests/test_regression.py	2010-09-12 21:17:28 UTC (rev 6789)
+++ trunk/scipy/interpolate/tests/test_regression.py	2010-09-12 21:18:42 UTC (rev 6790)
@@ -1,6 +1,6 @@
 import numpy as np
 import scipy.interpolate as interp
-from numpy.testing import *
+from numpy.testing import assert_almost_equal, TestCase
 
 class TestRegression(TestCase):
     def test_spalde_scalar_input(self):



More information about the Scipy-svn mailing list