[pypy-commit] pypy numpy-fancy-indexing: Start working on fancy indexing. The first test

fijal noreply at buildbot.pypy.org
Mon Sep 17 20:13:30 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-fancy-indexing
Changeset: r57370:63801ee0219f
Date: 2012-09-17 20:13 +0200
http://bitbucket.org/pypy/pypy/changeset/63801ee0219f/

Log:	Start working on fancy indexing. The first test

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
@@ -1517,6 +1517,13 @@
         a = array([1.0,-1.0])
         a[a<0] = -a[a<0]
         assert (a == [1, 1]).all()
+
+    def test_int_array_index(self):
+        from numpypy import array, arange
+        assert (arange(10)[array([3, 2, 1, 5])] == [3, 2, 1, 5]).all()
+        raises(IndexError, "arange(10)[array([10])]")
+        assert (arange(10)[[-5, -3]] == [5, 7]).all()
+        raises(IndexError, "arange(10)[[-11]]")
                         
 class AppTestMultiDim(BaseNumpyAppTest):
     def test_init(self):


More information about the pypy-commit mailing list