[pypy-commit] pypy default: fix translation, fix test for removed numpy.py file
mattip
noreply at buildbot.pypy.org
Mon Oct 14 22:00:54 CEST 2013
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r67369:f25225624539
Date: 2013-10-14 21:27 +0300
http://bitbucket.org/pypy/pypy/changeset/f25225624539/
Log: fix translation, fix test for removed numpy.py file
diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -78,9 +78,16 @@
def descr_accumulate(self, space, w_obj, w_axis=None, w_dtype=None, w_out=None):
if space.is_none(w_axis) or w_axis is None:
w_axis = space.wrap(0)
+ if space.is_none(w_out):
+ out = None
+ elif not isinstance(w_out, W_NDimArray):
+ raise OperationError(space.w_TypeError, space.wrap(
+ 'output must be an array'))
+ else:
+ out = w_out
return self.reduce(space, w_obj, False, #do not promote_to_largest
w_axis, True, #keepdims must be true
- w_out, w_dtype, cumultative=True)
+ out, w_dtype, cumultative=True)
@unwrap_spec(skipna=bool, keepdims=bool)
def descr_reduce(self, space, w_obj, w_axis=None, w_dtype=None,
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
@@ -97,11 +97,11 @@
# check doubles
from numpypy import array, nan, zeros, complex128, arange
- from numpy import isnan
+ from math import isnan
a = array([nan, 1, 0])
b = a.copy()
b.sort()
- assert (isnan(b) == isnan(a[::-1])).all()
+ assert [isnan(bb) for bb in b] == [isnan(aa) for aa in a[::-1]]
assert (b[:2] == a[::-1][:2]).all()
# check complex
@@ -110,7 +110,7 @@
a.imag += [nan, 1, 0, nan, nan, 1, 0, 1, 0]
b = a.copy()
b.sort()
- assert (isnan(b) == isnan(a[::-1])).all()
+ assert [isnan(bb) for bb in b] == [isnan(aa) for aa in a[::-1]]
assert (b[:4] == a[::-1][:4]).all()
# all c scalar sorts use the same code with different types
More information about the pypy-commit
mailing list