[pypy-commit] pypy default: remove some dead code, and added missing tests

alex_gaynor noreply at buildbot.pypy.org
Tue Dec 6 20:06:50 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r50219:d62de66be4aa
Date: 2011-12-06 14:06 -0500
http://bitbucket.org/pypy/pypy/changeset/d62de66be4aa/

Log:	remove some dead code, and added missing tests

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -714,11 +714,6 @@
     def _index_of_single_item(self, space, w_idx):
         if space.isinstance_w(w_idx, space.w_int):
             idx = space.int_w(w_idx)
-            if not self.shape:
-                if idx != 0:
-                    raise OperationError(space.w_IndexError,
-                                         space.wrap("index out of range"))
-                return 0
             if idx < 0:
                 idx = self.shape[0] + idx
             if idx < 0 or idx >= self.shape[0]:
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
@@ -330,8 +330,8 @@
     def test_scalar(self):
         from numpypy import array, dtype
         a = array(3)
-        #assert a[0] == 3
         raises(IndexError, "a[0]")
+        raises(IndexError, "a[0] = 5")
         assert a.size == 1
         assert a.shape == ()
         assert a.dtype is dtype(int)
@@ -415,6 +415,9 @@
         # u is not a view, it is a copy!
         assert u[25] == 41
 
+        a = zeros((5, 2))
+        assert a.reshape(-1).shape == (10,)
+
         raises(ValueError, arange(10).reshape, (5, -1, -1))
 
     def test_reshape_varargs(self):


More information about the pypy-commit mailing list