Author: mattip <[email protected]>
Branch: numpy-fixes
Changeset: r77168:02dfc7f1c293
Date: 2015-05-06 20:23 +0300
http://bitbucket.org/pypy/pypy/changeset/02dfc7f1c293/
Log: move test and make 32-bit friendly, revert string comparison on cmp-
func execption
diff --git a/pypy/module/micronumpy/ndarray.py
b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -939,8 +939,8 @@
try:
return ufunc(self, space, w_other, w_out)
except OperationError, e:
- if e.match(space, space.w_ValueError) and \
- 'operands could not be broadcast together' in
str(e.get_w_value(space)):
+ if e.match(space, space.w_ValueError):
+ # and 'operands could not be broadcast together' in
str(e.get_w_value(space)):
return space.w_False
raise e
diff --git a/pypy/module/micronumpy/test/test_ndarray.py
b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -2220,6 +2220,12 @@
exc = raises(ValueError, a.astype, 'i8')
assert exc.value.message.startswith('invalid literal for int()')
+ a = arange(5, dtype=complex)
+ b = a.real
+ c = b.astype("int64")
+ assert c.shape == b.shape
+ assert c.strides == (8,)
+
def test_base(self):
from numpy import array
assert array(1).base is None
diff --git a/pypy/module/micronumpy/test/test_object_arrays.py
b/pypy/module/micronumpy/test/test_object_arrays.py
--- a/pypy/module/micronumpy/test/test_object_arrays.py
+++ b/pypy/module/micronumpy/test/test_object_arrays.py
@@ -164,11 +164,3 @@
a = np.array([(1, 'object')], dt)
# Wrong way - should complain about writing buffer to object dtype
raises(ValueError, np.array, [1, 'object'], dt)
-
- def test_astype(self):
- import numpy as np
- a = np.arange(5, dtype=complex)
- b = a.real
- c = b.astype("O")
- assert c.shape == b.shape
- assert c.strides == (8,)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit