summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-02-16 11:27:45 -0700
committerCharles Harris <charlesr.harris@gmail.com>2014-02-16 11:42:56 -0700
commit1c2ac8fd02cf6db60b2e15ec994b8febe025424a (patch)
tree866c7e467a5d1d32f826c7eef50bf750081713be /numpy/lib/tests/test_function_base.py
parent2868dc4a0513f58eafc013f3ba3d84ae07113199 (diff)
downloadnumpy-1c2ac8fd02cf6db60b2e15ec994b8febe025424a.tar.gz
BUG: Make interp return NaN at NaN interpolation points.
A NaN interpolation point was interpreted as out of bounds on the left side, hence the value of the left parameter in the function call was returned. >>> np.interp(np.nan, [-10, 10], [-2, 2]) -2.0 NaN is a better choice. Closes #605.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 003d3e541..8035ac002 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1490,6 +1490,8 @@ class TestInterp(TestCase):
assert_almost_equal(np.interp(x0, x, y), x0)
x0 = np.float64(.3)
assert_almost_equal(np.interp(x0, x, y), x0)
+ x0 = np.nan
+ assert_almost_equal(np.interp(x0, x, y), x0)
def test_zero_dimensional_interpolation_point(self):
x = np.linspace(0, 1, 5)