Author: Matti Picus <[email protected]>
Branch: 
Changeset: r65128:12ed8f9fbc83
Date: 2013-06-30 22:13 +0300
http://bitbucket.org/pypy/pypy/changeset/12ed8f9fbc83/

Log:    test, fix for shape modification in view()

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
@@ -630,7 +630,7 @@
         old_itemsize = self.get_dtype().get_size()
         new_itemsize = dtype.get_size()
         impl = self.implementation
-        new_shape = self.get_shape()
+        new_shape = self.get_shape()[:]
         dims = len(new_shape)
         if dims == 0:
             # Cannot resize scalars
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
@@ -1411,16 +1411,17 @@
         assert a[3].imag == -10
         assert a[2].imag == -5
 
-    def test_ndarray_view(self):
+    def test_view(self):
         from numpypy import array, int8, int16, dtype
-        x = array([(1, 2)], dtype=[('a', int8), ('b', int8)])
+        x = array((1, 2), dtype=int8)
+        assert x.shape == (2,)
         y = x.view(dtype=int16)
-        print y,y.shape
+        assert x.shape == (2,)
         assert y[0] == 513
         assert y.dtype == dtype('int16')
         y[0] = 670
-        assert x['a'] == -98
-        assert x['b'] == 2
+        assert x[0] == -98
+        assert x[1] == 2
         f = array([1000, -1234], dtype='i4')
         nnp = self.non_native_prefix
         d = f.view(dtype=nnp + 'i4')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to