Author: Maciej Fijalkowski <[email protected]>
Branch: refactor-signature
Changeset: r50722:a063abcf2a3c
Date: 2011-12-19 23:19 +0200
http://bitbucket.org/pypy/pypy/changeset/a063abcf2a3c/

Log:    write some tests. They expose a bug

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
@@ -871,6 +871,19 @@
         b[0] = 3
         assert b.__debug_repr__() == 'Array'
 
+    def test_virtual_views(self):
+        from numpypy import arange
+        a = arange(15)
+        c = (a + a)
+        d = c[::2]
+        assert d[3] == 12
+        c[6] = 5
+        assert d[3] == 5
+        a = arange(15)
+        c = (a + a)
+        d = c[::2][::2]
+        assert d[1] == 8
+
 class AppTestMultiDim(BaseNumpyAppTest):
     def test_init(self):
         import numpypy
@@ -1039,6 +1052,14 @@
         b[:] = (a + a)
         assert (b == zeros((4, 3, 5))).all()
 
+    def test_broadcast_virtualview(self):
+        from numpypy import arange, zeros
+        a = arange(8).reshape([2, 2, 2])
+        b = (a + a)[1, 1]
+        c = zeros((2, 2, 2))
+        c[:] = b
+        assert (c == [[[12, 14], [12, 14]], [[12, 14], [12, 14]]]).all()
+
     def test_argmax(self):
         from numpypy import array
         a = array([[1, 2], [3, 4], [5, 6]])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to