[Numpy-svn] r8434 - trunk/numpy/lib/tests
numpy-svn at scipy.org
numpy-svn at scipy.org
Mon May 24 11:47:32 EDT 2010
Author: charris
Date: 2010-05-24 10:47:32 -0500 (Mon, 24 May 2010)
New Revision: 8434
Modified:
trunk/numpy/lib/tests/test_function_base.py
Log:
ENH: Test the exceptions and the left, right keywords of the interp
function.
Modified: trunk/numpy/lib/tests/test_function_base.py
===================================================================
--- trunk/numpy/lib/tests/test_function_base.py 2010-05-24 15:47:29 UTC (rev 8433)
+++ trunk/numpy/lib/tests/test_function_base.py 2010-05-24 15:47:32 UTC (rev 8434)
@@ -935,12 +935,22 @@
class TestInterp(TestCase):
+ def test_exceptions(self):
+ assert_raises(ValueError, interp, 0, [], [])
+ assert_raises(ValueError, interp, 0, [0], [1, 2])
+
def test_basic(self):
x = np.linspace(0, 1, 5)
y = np.linspace(0, 1, 5)
x0 = np.linspace(0, 1, 50)
assert_almost_equal(np.interp(x0, x, y), x0)
+ def test_right_left_behavior(self):
+ assert_equal(interp([-1, 0, 1], [0], [1]), [1,1,1])
+ assert_equal(interp([-1, 0, 1], [0], [1], left=0), [0,1,1])
+ assert_equal(interp([-1, 0, 1], [0], [1], right=0), [1,1,0])
+ assert_equal(interp([-1, 0, 1], [0], [1], left=0, right=0), [0,1,0])
+
def test_scalar_interpolation_point(self):
x = np.linspace(0, 1, 5)
y = np.linspace(0, 1, 5)
More information about the Numpy-svn
mailing list