[pypy-commit] pypy default: add failing tests that pass with upstream -A

mattip noreply at buildbot.pypy.org
Sun Sep 27 11:57:28 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r79860:5c67d551e0c5
Date: 2015-09-27 02:35 +0300
http://bitbucket.org/pypy/pypy/changeset/5c67d551e0c5/

Log:	add failing tests that pass with upstream -A

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
@@ -2218,7 +2218,7 @@
         assert _weakref.ref(a)
 
     def test_astype(self):
-        from numpy import array, arange
+        from numpy import array, arange, empty
         b = array(1).astype(float)
         assert b == 1
         assert b.dtype == float
@@ -2273,14 +2273,36 @@
         b = a.astype('f4', order='C', copy=False)
         assert a is b
 
+        a = empty([3, 3, 3, 3], 'uint8')
+        a[:] = 0
+        b = a[2]
+        c = b[:, :2, :]
+        d = c.swapaxes(1, -1)
+        e = d.astype('complex128')
+        assert e.shape == (3, 3, 2)
+        assert e.strides == (96, 16, 48)
+        assert (e.real == d).all()
+
     def test_base(self):
-        from numpy import array
+        from numpy import array, empty
         assert array(1).base is None
         assert array([1, 2]).base is None
         a = array([1, 2, 3, 4])
         b = a[::2]
         assert b.base is a
 
+        a = empty([3, 3, 3, 3], 'uint8')
+        a[:] = 0
+        b = a[2]
+        assert b.base.base is None
+        c = b[:, :2, :]
+        d = c.swapaxes(1, -1)
+        assert c.base.base is None
+        assert d.base.base is None
+        assert d.shape == (3, 3, 2)
+        assert d.__array_interface__['data'][0] == \
+               a.__array_interface__['data'][0] + a.strides[0] * 2
+
     def test_byteswap(self):
         from numpy import array
 


More information about the pypy-commit mailing list