Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r73876:4910e986b85d Date: 2014-10-09 18:03 -0400 http://bitbucket.org/pypy/pypy/changeset/4910e986b85d/
Log: fix searchsorted on array scalar diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py --- a/pypy/module/micronumpy/ndarray.py +++ b/pypy/module/micronumpy/ndarray.py @@ -735,7 +735,7 @@ raise OperationError(space.w_NotImplementedError, space.wrap( 'sorter not supported in searchsort')) side = searchside_converter(space, w_side) - if len(self.get_shape()) > 1: + if len(self.get_shape()) != 1: raise oefmt(space.w_ValueError, "a must be a 1-d array") v = convert_to_array(space, w_v) ret = W_NDimArray.from_shape( diff --git a/pypy/module/micronumpy/test/test_selection.py b/pypy/module/micronumpy/test/test_selection.py --- a/pypy/module/micronumpy/test/test_selection.py +++ b/pypy/module/micronumpy/test/test_selection.py @@ -352,7 +352,10 @@ def test_searchsort(self): import numpy as np - import sys + + a = np.array(2) + raises(ValueError, a.searchsorted, 3) + a = np.arange(1, 6) ret = a.searchsorted(3) @@ -389,5 +392,6 @@ ret = a.searchsorted([-10, 10, 2, 3]) assert (ret == [0, 5, 1, 2]).all() + import sys if '__pypy__' in sys.builtin_module_names: raises(NotImplementedError, "a.searchsorted(3, sorter=range(6))") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit