Author: Matti Picus <[email protected]>
Branch: numpypy-problems
Changeset: r58242:cfa9c1076990
Date: 2012-10-19 13:09 +0200
http://bitbucket.org/pypy/pypy/changeset/cfa9c1076990/
Log: test, fix repr() for StringArray
diff --git a/lib_pypy/numpypy/core/numeric.py b/lib_pypy/numpypy/core/numeric.py
--- a/lib_pypy/numpypy/core/numeric.py
+++ b/lib_pypy/numpypy/core/numeric.py
@@ -1,5 +1,5 @@
-from _numpypy import array, ndarray, int_, float_, bool_ #, complex_# ,
longlong
+from _numpypy import array, ndarray, int_, float_, bool_, flexible #,
complex_# , longlong
from _numpypy import concatenate
from .fromnumeric import any
import math
@@ -200,7 +200,7 @@
typename = "'%s'" % typename
lf = ''
- if 0: # or issubclass(arr.dtype.type, flexible):
+ if issubclass(arr.dtype.type, flexible):
if arr.dtype.names:
typename = "%s" % str(arr.dtype)
else:
diff --git a/pypy/module/micronumpy/test/test_numarray.py
b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -2247,7 +2247,7 @@
assert a[0]['x'] == 'a'
def test_stringarray(self):
- from _numpypy import array
+ from _numpypy import array, flexible
a = array(['abc'],'S3')
assert str(a.dtype) == '|S3'
a = array(['abc'])
@@ -2266,8 +2266,10 @@
from _numpypy import array
a = array(['abc'],'S3')
s = repr(a)
- # simplify \n in repr
+ # simplify test for \n in repr
assert s.replace('\n', '') == "array(['abc'], dtype='|S3')"
+ # but make sure it exists
+ assert s.find('\n') == 15
a = array(['abc','defg','ab'])
s = repr(a)
assert s.replace('\n', '') == \
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit