Commits

mattip committed 7f81f9f

add failing tests for axis argument

  • Participants
  • Parent commits 0bcaf2f
  • Branches nupypy-axis-arg-check

Comments (0)

Files changed (2)

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

         assert (a.sum(0) == [30, 35, 40]).all()
         assert (a.sum(axis=0) == [30, 35, 40]).all()
         assert (a.sum(1) == [3, 12, 21, 30, 39]).all()
+        assert (a.sum(-1) == a.sum(-1)).all()
+        assert (a.sum(-2) == a.sum(-2)).all()
+        raises(ValueError, a.sum, -3)
+        raises(ValueError, a.sum, 2)
         assert (a.max(0) == [12, 13, 14]).all()
         assert (a.max(1) == [2, 5, 8, 11, 14]).all()
         assert ((a + a).max() == 28)

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

         a = arange(12).reshape(3, 4)
         assert (add.reduce(a, 0) == [12, 15, 18, 21]).all()
         assert (add.reduce(a, 1) == [6.0, 22.0, 38.0]).all()
+        raises(ValueError, add.reduce, a, 2)
 
     def test_reduce_keepdims(self):
         from _numpypy import add, arange
         assert count_reduce_items(a) == 24
         assert count_reduce_items(a, 1) == 3
         assert count_reduce_items(a, (1, 2)) == 3 * 4
+        raises(ValueError, count_reduce_items, a, -3)
 
     def test_true_divide(self):
         from _numpypy import arange, array, true_divide