[pypy-commit] pypy numpy-searchsorted: add tests
mattip
noreply at buildbot.pypy.org
Fri Apr 18 00:33:18 CEST 2014
Author: Matti Picus <matti.picus at 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)")
+
More information about the pypy-commit
mailing list