diff options
author | Matti Picus <matti.picus@gmail.com> | 2019-07-05 11:27:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-05 11:27:55 -0700 |
commit | 57b16ed568581c33d0a6b6d3d4254dce3b67b321 (patch) | |
tree | 606d8f9f52a117328281acf366874144b02ed58c /numpy/lib/tests/test_function_base.py | |
parent | 259b6e35622ae84def1399214ca2e6643f433fad (diff) | |
parent | 5911fea9a2e880fe4c655af4d667d57d45121f91 (diff) | |
download | numpy-57b16ed568581c33d0a6b6d3d4254dce3b67b321.tar.gz |
Merge pull request #13916 from seberg/issue-13894
BUG: i0 Bessel function regression on array-likes supporting ufuncs
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index c0b8ad6b8..eae52c002 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -2005,6 +2005,22 @@ class Test_I0(object): assert_equal(i0_0.shape, (1,)) assert_array_equal(np.i0([0.]), np.array([1.])) + def test_non_array(self): + a = np.arange(4) + + class array_like: + __array_interface__ = a.__array_interface__ + + def __array_wrap__(self, arr): + return self + + # E.g. pandas series survive ufunc calls through array-wrap: + assert isinstance(np.abs(array_like()), array_like) + exp = np.i0(a) + res = np.i0(array_like()) + + assert_array_equal(exp, res) + class TestKaiser(object): |