Author: Matti Picus <matti.pi...@gmail.com> Branch: numpy-searchsorted Changeset: r70728:11986490eee7 Date: 2014-04-18 01:28 +0300 http://bitbucket.org/pypy/pypy/changeset/11986490eee7/
Log: add tests diff --git a/pypy/module/micronumpy/test/test_sorting.py b/pypy/module/micronumpy/test/test_sorting.py --- a/pypy/module/micronumpy/test/test_sorting.py +++ b/pypy/module/micronumpy/test/test_sorting.py @@ -341,7 +341,7 @@ assert (x == y).all() def test_string_mergesort(self): - import numpypy as np + import numpy as np import sys x = np.array(['a'] * 32) if '__pypy__' in sys.builtin_module_names: @@ -349,3 +349,17 @@ assert 'non-numeric types' in exc.value.message else: assert (x.argsort(kind='m') == np.arange(32)).all() + + def test_searchsort(self): + from numpy import arange + import sys + a = arange(1, 6) + ret = a.searchsorted(3) + assert ret == 2 + ret = a.searchsorted(3, side='right') + assert ret == 3 + ret = a.searchsorted([-10, 10, 2, 3]) + assert (ret == [0, 5, 1, 2]).all() + 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