Commit 06f6bf39 authored by jbrockmendel's avatar jbrockmendel Committed by GitHub

Fix PyArray_SearchSorted signature (GH-3606)

parent 662cc6b2
......@@ -302,7 +302,6 @@ cdef extern from "numpy/arrayobject.h":
"""
return PyArray_BYTES(self)
ctypedef unsigned char npy_bool
ctypedef signed char npy_byte
......@@ -655,7 +654,7 @@ cdef extern from "numpy/arrayobject.h":
object PyArray_Choose (ndarray, object, ndarray, NPY_CLIPMODE)
int PyArray_Sort (ndarray, int, NPY_SORTKIND)
object PyArray_ArgSort (ndarray, int, NPY_SORTKIND)
object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE)
object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE, PyObject*)
object PyArray_ArgMax (ndarray, int, ndarray)
object PyArray_ArgMin (ndarray, int, ndarray)
object PyArray_Reshape (ndarray, object)
......
......@@ -944,3 +944,17 @@ def test_broadcast_comparison(np.ndarray[double, ndim=1] a):
cdef object obj = a
return a == 0, obj == 0, a == 1, obj == 1
@testcase
def test_c_api_searchsorted(np.ndarray arr, other):
"""
>>> arr = np.random.randn(10)
>>> other = np.random.randn(5)
>>> result, expected = test_c_api_searchsorted(arr, other)
>>> (result == expected).all()
True
"""
result = np.PyArray_SearchSorted(arr, other, np.NPY_SEARCHRIGHT, NULL)
expected = arr.searchsorted(other, side="right")
return result, expected
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment