Commits

Brian Kearns  committed f9a5cce

fix these error messages

  • Participants
  • Parent commits 8698a44

Comments (0)

Files changed (2)

File pypy/module/micronumpy/arrayimpl/scalar.py

             if space.len_w(w_idx) == 0:
                 return self.get_scalar_value()
         raise OperationError(space.w_IndexError,
-                             space.wrap("scalars cannot be indexed"))
+                             space.wrap("0-d arrays can't be indexed"))
 
     def getitem_index(self, space, idx):
         raise OperationError(space.w_IndexError,
-                             space.wrap("scalars cannot be indexed"))
+                             space.wrap("0-d arrays can't be indexed"))
 
     def descr_setitem(self, space, _, w_idx, w_val):
         raise OperationError(space.w_IndexError,
-                             space.wrap("scalars cannot be indexed"))
+                             space.wrap("0-d arrays can't be indexed"))
 
     def setitem_index(self, space, idx, w_val):
         raise OperationError(space.w_IndexError,
-                             space.wrap("scalars cannot be indexed"))
+                             space.wrap("0-d arrays can't be indexed"))
+
     def set_shape(self, space, orig_array, new_shape):
         if not new_shape:
             return self

File pypy/module/micronumpy/test/test_numarray.py

     def test_scalar(self):
         from numpypy import array, dtype, int_
         a = array(3)
-        raises(IndexError, "a[0]")
-        raises(IndexError, "a[0] = 5")
+        exc = raises(IndexError, "a[0]")
+        assert exc.value[0] == "0-d arrays can't be indexed"
+        exc = raises(IndexError, "a[0] = 5")
+        assert exc.value[0] == "0-d arrays can't be indexed"
         assert a.size == 1
         assert a.shape == ()
         assert a.dtype is dtype(int)