Author: Brian Kearns <[email protected]>
Branch:
Changeset: r61637:25681452af3c
Date: 2013-02-22 21:47 -0500
http://bitbucket.org/pypy/pypy/changeset/25681452af3c/
Log: update numarray min/max tests to show why the app-level workaround
is the wrong approach
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
@@ -1141,7 +1141,7 @@
assert (a.mean(1) == [0.5, 2.5, 4.5, 6.5, 8.5]).all()
def test_sum(self):
- from _numpypy import array
+ from _numpypy import array, zeros
a = array(range(5))
assert a.sum() == 10
assert a[:4].sum() == 6
@@ -1156,6 +1156,8 @@
assert b == d
assert b is d
+ assert list(zeros((0, 2)).sum(axis=1)) == []
+
def test_reduce_nd(self):
from numpypy import arange, array, multiply
a = arange(15).reshape(5, 3)
@@ -1242,24 +1244,28 @@
assert a[:4].prod() == 24.0
def test_max(self):
- from _numpypy import array
+ from _numpypy import array, zeros
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
assert a.max() == 5.7
b = array([])
raises(ValueError, "b.max()")
+ assert list(zeros((0, 2)).max(axis=1)) == []
+
def test_max_add(self):
from _numpypy import array
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
assert (a + a).max() == 11.4
def test_min(self):
- from _numpypy import array
+ from _numpypy import array, zeros
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
assert a.min() == -3.0
b = array([])
raises(ValueError, "b.min()")
+ assert list(zeros((0, 2)).min(axis=1)) == []
+
def test_argmax(self):
from _numpypy import array
a = array([-1.2, 3.4, 5.7, -3.0, 2.7])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit