Author: mattip <[email protected]>
Branch: nupypy-axis-arg-check
Changeset: r55694:7f81f9f0ac0f
Date: 2012-06-15 13:35 +0300
http://bitbucket.org/pypy/pypy/changeset/7f81f9f0ac0f/
Log: add failing tests for axis argument
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
@@ -1112,6 +1112,10 @@
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)
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py
b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -573,6 +573,7 @@
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
@@ -636,6 +637,7 @@
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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit