[pypy-commit] pypy newindex: still more tests

MichaelBlume noreply at buildbot.pypy.org
Sat Mar 17 09:38:36 CET 2012


Author: Mike Blume <mike at loggly.com>
Branch: newindex
Changeset: r53757:cb80a924de4c
Date: 2012-03-14 17:25 -0700
http://bitbucket.org/pypy/pypy/changeset/cb80a924de4c/

Log:	still more tests

	slice then newaxis, newaxis then slice

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
@@ -407,10 +407,24 @@
         from numpypy.core.numeric import newaxis
 
         a = array(range(5))
-        b = (a + a)[None]
+        b = (a + a)[newaxis]
         c = array([[0, 2, 4, 6, 8]])
         assert (b == c).all()
 
+    def test_newaxis_then_slice(self):
+        from _numpypy import array
+        from numpypy.core.numeric import newaxis
+        a = array(range(5))
+        b = a[newaxis]
+        assert (b[0,1:] == a[1:]).all()
+
+    def test_slice_then_newaxis(self):
+        from _numpypy import array
+        from numpypy.core.numeric import newaxis
+        a = array(range(5))
+        b = a[2:]
+        assert (b[newaxis] == [[2, 3, 4]]).all()
+
     def test_scalar(self):
         from _numpypy import array, dtype
         a = array(3)


More information about the pypy-commit mailing list