summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2018-06-03 14:24:12 -0400
committerMarten van Kerkwijk <mhvk@astro.utoronto.ca>2019-06-12 09:57:52 -0400
commit98b68bd97f636d56ceee36f2af0122c34ee2c64d (patch)
treeabd32fa160c0908b7933921eb8a06f889ba5b64b /numpy/lib/tests/test_function_base.py
parent1b26276395f3a4214cb678a74961a6bc3a102069 (diff)
downloadnumpy-98b68bd97f636d56ceee36f2af0122c34ee2c64d.tar.gz
BUG: ensure i0 does not change the shape.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index a3d4c6efb..93ebabae0 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1984,9 +1984,9 @@ class Test_I0(object):
np.array(1.0634833707413234))
A = np.array([0.49842636, 0.6969809, 0.22011976, 0.0155549])
- assert_almost_equal(
- i0(A),
- np.array([1.06307822, 1.12518299, 1.01214991, 1.00006049]))
+ expected = np.array([1.06307822, 1.12518299, 1.01214991, 1.00006049])
+ assert_almost_equal(i0(A), expected)
+ assert_almost_equal(i0(-A), expected)
B = np.array([[0.827002, 0.99959078],
[0.89694769, 0.39298162],
@@ -2000,6 +2000,10 @@ class Test_I0(object):
[1.03633899, 1.00067775],
[1.03352052, 1.13557954],
[1.05884290, 1.06432317]]))
+ # Regression test for gh-11205
+ i0_0 = np.i0([0.])
+ assert_equal(i0_0.shape, (1,))
+ assert_array_equal(np.i0([0.]), np.array([1.]))
class TestKaiser(object):