Commits

Maciej Fijalkowski committed b5668c7

more tests and a fix

  • Participants
  • Parent commits d1cbcc3
  • Branches numpy-indexing-by-arrays-2

Comments (0)

Files changed (2)

pypy/module/micronumpy/interp_iter.py

         for i in range(shapelen - 1, -1, -1):
             if self.indices[i] < self.shape[i] - 1:
                 self.indices[i] += 1
-                self.chunk_iters[i] = self.chunk_iters[i].next()
+                self.chunk_iters[i] = self.chunk_iters[i].next(shapelen)
                 break
             else:
                 self.indices[i] = 0

pypy/module/micronumpy/test/test_numarray.py

         raises(IndexError,'arange(3)[array([15])]')
         assert arange(3)[array([-3])] == 0
         raises(IndexError,'arange(3)[array([-15])]')
+        a = arange(10)
+        assert (a[array([3, 2, 1])] == [3, 2, 1]).all()
+        raises(IndexError, 'a[array([3, 2, 1, 15])]')
+        assert (a[array([3, 2, 5, 3])] == [3, 2, 5, 3]).all()
 
     def test_fill(self):
         from _numpypy import array