Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r67942:808f15933ea2 Date: 2013-11-10 21:48 -0500 http://bitbucket.org/pypy/pypy/changeset/808f15933ea2/
Log: link the ndarray.{resize,squeeze} stubs diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py --- a/pypy/module/micronumpy/interp_numarray.py +++ b/pypy/module/micronumpy/interp_numarray.py @@ -640,7 +640,8 @@ def descr_put(self, space, w_indices, w_values, w_mode=None): put(space, self, w_indices, w_values, w_mode) - def descr_resize(self, space, w_new_shape, w_refcheck=True): + @unwrap_spec(w_refcheck=WrappedDefault(True)) + def descr_resize(self, space, w_new_shape, w_refcheck=None): raise OperationError(space.w_NotImplementedError, space.wrap( "resize not implemented yet")) @@ -692,7 +693,7 @@ return return self.implementation.sort(space, w_axis, w_order) - def descr_squeeze(self, space): + def descr_squeeze(self, space, w_axis=None): raise OperationError(space.w_NotImplementedError, space.wrap( "squeeze not implemented yet")) @@ -1218,6 +1219,8 @@ copy = interp2app(W_NDimArray.descr_copy), reshape = interp2app(W_NDimArray.descr_reshape), + resize = interp2app(W_NDimArray.descr_resize), + squeeze = interp2app(W_NDimArray.descr_squeeze), T = GetSetProperty(W_NDimArray.descr_get_transpose), transpose = interp2app(W_NDimArray.descr_transpose), tolist = interp2app(W_NDimArray.descr_tolist), 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 @@ -1713,6 +1713,19 @@ 4, 4]]).all() assert (array([1, 2]).repeat(2) == array([1, 1, 2, 2])).all() + def test_resize(self): + import numpy as np + a = np.array([1,2,3]) + import sys + if '__pypy__' in sys.builtin_module_names: + raises(NotImplementedError, a.resize, ()) + + def test_squeeze(self): + import numpy as np + a = np.array([1,2,3]) + import sys + if '__pypy__' in sys.builtin_module_names: + raises(NotImplementedError, a.squeeze) def test_swapaxes(self): from numpypy import array _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit