Author: Ronan Lamy <[email protected]>
Branch: unicode-dtype
Changeset: r78003:4cfe2a34d2ff
Date: 2015-06-09 18:25 +0100
http://bitbucket.org/pypy/pypy/changeset/4cfe2a34d2ff/
Log: update test, since unicode is implemented but sorting still isn't
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
@@ -210,22 +210,28 @@
assert (c == a).all(), msg
def test_sort_unicode(self):
+ import sys
from numpy import array
# test unicode sorts.
s = 'aaaaaaaa'
- try:
- a = array([s + chr(i) for i in range(101)], dtype=unicode)
- b = a[::-1].copy()
- except:
- skip('unicode type not supported yet')
- for kind in ['q', 'm', 'h'] :
+ a = array([s + chr(i) for i in range(101)], dtype=unicode)
+ b = a[::-1].copy()
+ for kind in ['q', 'm', 'h']:
msg = "unicode sort, kind=%s" % kind
- c = a.copy();
- c.sort(kind=kind)
- assert (c == a).all(), msg
- c = b.copy();
- c.sort(kind=kind)
- assert (c == a).all(), msg
+ c = a.copy()
+ if '__pypy__' in sys.builtin_module_names:
+ exc = raises(NotImplementedError, "c.sort(kind=kind)")
+ assert 'non-numeric types' in exc.value.message
+ else:
+ c.sort(kind=kind)
+ assert (c == a).all(), msg
+ c = b.copy()
+ if '__pypy__' in sys.builtin_module_names:
+ exc = raises(NotImplementedError, "c.sort(kind=kind)")
+ assert 'non-numeric types' in exc.value.message
+ else:
+ c.sort(kind=kind)
+ assert (c == a).all(), msg
def test_sort_objects(self):
# test object array sorts.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit