summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2009-03-27 16:24:41 +0000
committerCharles Harris <charlesr.harris@gmail.com>2009-03-27 16:24:41 +0000
commitb4be5ddb4467ee212359418ed2684ef7edf46ba8 (patch)
tree7f4338a90599f1ab15fb437cfb79fd9c96ff236d /numpy
parentbc70602d5fb6adcf3cfe19883aeac72ef015d3ae (diff)
downloadnumpy-b4be5ddb4467ee212359418ed2684ef7edf46ba8.tar.gz
Fix eigenvalue tests, the eigenvalues needed sorting.
Fix test_nanmin_alnan_on_axis, use assert_array_equal.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/tests/test_function_base.py2
-rw-r--r--numpy/linalg/tests/test_linalg.py16
2 files changed, 9 insertions, 9 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 6b7a1efc2..fc8781fda 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -755,7 +755,7 @@ class TestNaNFuncts(TestCase):
[ 0.91084584, 0.84386844, 0.37068164]]))
def test_nanmin_allnan_on_axis(self):
- assert_equal(isnan(nanmin([[nan]*2]*3, axis=1)),
+ assert_array_equal(isnan(nanmin([[nan]*2]*3, axis=1)),
[True, True, True])
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py
index 3330db2a3..849f30a50 100644
--- a/numpy/linalg/tests/test_linalg.py
+++ b/numpy/linalg/tests/test_linalg.py
@@ -240,22 +240,22 @@ class HermitianTestCase(object):
class TestEigvalsh(HermitianTestCase, TestCase):
def do(self, a):
+ # note that eigenvalue arrays must be sorted since
+ # their order isn't guaranteed.
ev = linalg.eigvalsh(a)
- # flip resulting eigenvalue array, since they are returned in
- # reverse order from the values given by linal.eig
- ev = ev[::-1]
-
evalues, evectors = linalg.eig(a)
+ ev.sort()
+ evalues.sort()
assert_almost_equal(ev, evalues)
class TestEigh(HermitianTestCase, TestCase):
def do(self, a):
+ # note that eigenvalue arrays must be sorted since
+ # their order isn't guaranteed.
ev, evc = linalg.eigh(a)
- # flip resulting eigenvalue array, since they are returned in
- # reverse order from the values given by linal.eig
- ev = ev[::-1]
-
evalues, evectors = linalg.eig(a)
+ ev.sort()
+ evalues.sort()
assert_almost_equal(ev, evalues)
class _TestNorm(TestCase):