summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 73fcc5621..e345f5668 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -935,12 +935,22 @@ class TestBincount(TestCase):
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)