summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2018-02-26 09:11:31 -0500
committerGitHub <noreply@github.com>2018-02-26 09:11:31 -0500
commit8282036f0938234efab936152ad963b9ddccca83 (patch)
treec255b37b3c296f5d79a8f5b1aada93f9fb5b32f7 /numpy/lib/tests/test_function_base.py
parent1ee1a4ac7f79e8c707c416f81f049fd3ac94f1e6 (diff)
parent8eccbf7df2f564e23c1bf7c9f5ee08e4b0dc6a36 (diff)
downloadnumpy-8282036f0938234efab936152ad963b9ddccca83.tar.gz
Merge pull request #10660 from eric-wieser/0d-interp-simpler
BUG/MAINT: Remove special cases for 0d arrays in interp
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index dc5fe3397..49b450175 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -2252,8 +2252,17 @@ class TestInterp(object):
y = np.linspace(0, 1, 5)
x0 = np.array(.3)
assert_almost_equal(np.interp(x0, x, y), x0)
- x0 = np.array(.3, dtype=object)
- assert_almost_equal(np.interp(x0, x, y), .3)
+
+ xp = np.array([0, 2, 4])
+ fp = np.array([1, -1, 1])
+
+ actual = np.interp(np.array(1), xp, fp)
+ assert_equal(actual, 0)
+ assert_(isinstance(actual, np.float64))
+
+ actual = np.interp(np.array(4.5), xp, fp, period=4)
+ assert_equal(actual, 0.5)
+ assert_(isinstance(actual, np.float64))
def test_if_len_x_is_small(self):
xp = np.arange(0, 10, 0.0001)