Author: Ronan Lamy <[email protected]>
Branch: unicode-dtype
Changeset: r77919:9d0ebecde2ab
Date: 2015-06-05 01:03 +0100
http://bitbucket.org/pypy/pypy/changeset/9d0ebecde2ab/
Log: Enable np.unicode_
diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py
--- a/pypy/module/micronumpy/boxes.py
+++ b/pypy/module/micronumpy/boxes.py
@@ -607,7 +607,6 @@
class W_UnicodeBox(W_CharacterBox):
def descr__new__unicode_box(space, w_subtype, w_arg):
- raise oefmt(space.w_NotImplementedError, "Unicode is not supported
yet")
from pypy.module.micronumpy.descriptor import new_unicode_dtype
arg = space.unicode_w(space.unicode_from_object(w_arg))
# XXX size computations, we need tests anyway
diff --git a/pypy/module/micronumpy/test/test_dtypes.py
b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -1059,12 +1059,8 @@
def test_unicode_boxes(self):
from numpy import unicode_
import sys
- if '__pypy__' in sys.builtin_module_names:
- exc = raises(NotImplementedError, unicode_, 3)
- assert exc.value.message.find('not supported yet') >= 0
- else:
- u = unicode_(3)
- assert isinstance(u, unicode)
+ u = unicode_(3)
+ assert isinstance(u, unicode)
def test_character_dtype(self):
import numpy as np
@@ -1133,7 +1129,7 @@
def test_array_from_record(self):
import numpy as np
- a = np.array(('???', -999, -12345678.9),
+ a = np.array(('???', -999, -12345678.9),
dtype=[('c', '|S3'), ('a', '<i8'), ('b', '<f8')])
# Change the order of the keys
b = np.array(a, dtype=[('a', '<i8'), ('b', '<f8'), ('c', '|S3')])
@@ -1141,7 +1137,7 @@
assert b.dtype.fields['a'][1] == 0
assert b['a'] == -999
a = np.array(('N/A', 1e+20, 1e+20, 999999),
- dtype=[('name', '|S4'), ('x', '<f8'),
+ dtype=[('name', '|S4'), ('x', '<f8'),
('y', '<f8'), ('block', '<i8', (2, 3))])
assert (a['block'] == 999999).all()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit