Author: Brian Kearns <[email protected]>
Branch:
Changeset: r67843:55261a401261
Date: 2013-11-04 22:25 -0500
http://bitbucket.org/pypy/pypy/changeset/55261a401261/
Log: provide scalar.squeeze()
diff --git a/pypy/module/micronumpy/interp_boxes.py
b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -265,6 +265,9 @@
raise OperationError(space.w_NotImplementedError, space.wrap(
"view not implelemnted yet"))
+ def descr_squeeze(self):
+ return self
+
def descr_get_dtype(self, space):
return self.get_dtype(space)
@@ -524,6 +527,7 @@
conjugate = interp2app(W_GenericBox.descr_conjugate),
astype = interp2app(W_GenericBox.descr_astype),
view = interp2app(W_GenericBox.descr_view),
+ squeeze = interp2app(W_GenericBox.descr_squeeze),
dtype = GetSetProperty(W_GenericBox.descr_get_dtype),
itemsize = GetSetProperty(W_GenericBox.descr_get_itemsize),
diff --git a/pypy/module/micronumpy/test/test_scalar.py
b/pypy/module/micronumpy/test/test_scalar.py
--- a/pypy/module/micronumpy/test/test_scalar.py
+++ b/pypy/module/micronumpy/test/test_scalar.py
@@ -65,6 +65,13 @@
assert type(a) is np.int32
assert a == 1
+ def test_squeeze(self):
+ import numpy as np
+ assert np.True_.squeeze() is np.True_
+ a = np.float32(1.0)
+ assert a.squeeze() is a
+ raises(TypeError, a.squeeze, 2)
+
def test_attributes(self):
import numpypy as np
value = np.dtype('int64').type(12345)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit