[pypy-commit] pypy newindex: new tests

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


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

Log:	new tests

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


More information about the pypy-commit mailing list