summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/linalg/tests/test_build.py6
-rw-r--r--numpy/linalg/tests/test_regression.py50
2 files changed, 28 insertions, 28 deletions
diff --git a/numpy/linalg/tests/test_build.py b/numpy/linalg/tests/test_build.py
index a91f97670..b46a72c02 100644
--- a/numpy/linalg/tests/test_build.py
+++ b/numpy/linalg/tests/test_build.py
@@ -5,7 +5,7 @@ import sys
import re
from numpy.linalg import lapack_lite
-from numpy.testing import TestCase, dec, run_module_suite
+from numpy.testing import run_module_suite, assert_, dec
class FindDependenciesLdd(object):
@@ -40,7 +40,7 @@ class FindDependenciesLdd(object):
return founds
-class TestF77Mismatch(TestCase):
+class TestF77Mismatch(object):
@dec.skipif(not(sys.platform[:5] == 'linux'),
"Skipping fortran compiler mismatch on non Linux platform")
@@ -48,7 +48,7 @@ class TestF77Mismatch(TestCase):
f = FindDependenciesLdd()
deps = f.grep_dependencies(lapack_lite.__file__,
[b'libg2c', b'libgfortran'])
- self.assertFalse(len(deps) > 1,
+ assert_(len(deps) <= 1,
"""Both g77 and gfortran runtimes linked in lapack_lite ! This is likely to
cause random crashes and wrong results. See numpy INSTALL.txt for more
information.""")
diff --git a/numpy/linalg/tests/test_regression.py b/numpy/linalg/tests/test_regression.py
index d2080b709..558abca09 100644
--- a/numpy/linalg/tests/test_regression.py
+++ b/numpy/linalg/tests/test_regression.py
@@ -7,7 +7,7 @@ import warnings
import numpy as np
from numpy import linalg, arange, float64, array, dot, transpose
from numpy.testing import (
- TestCase, run_module_suite, assert_equal, assert_array_equal,
+ run_module_suite, assert_, assert_raises, assert_equal, assert_array_equal,
assert_array_almost_equal, assert_array_less
)
@@ -15,7 +15,7 @@ from numpy.testing import (
rlevel = 1
-class TestRegression(TestCase):
+class TestRegression(object):
def test_eig_build(self, level=rlevel):
# Ticket #652
@@ -64,7 +64,7 @@ class TestRegression(TestCase):
def test_norm_vector_badarg(self):
# Regression for #786: Froebenius norm for vectors raises
# TypeError.
- self.assertRaises(ValueError, linalg.norm, array([1., 2., 3.]), 'fro')
+ assert_raises(ValueError, linalg.norm, array([1., 2., 3.]), 'fro')
def test_lapack_endian(self):
# For bug #1482
@@ -98,47 +98,47 @@ class TestRegression(TestCase):
norm = linalg.norm(testvector)
assert_array_equal(norm, [0, 1])
- self.assertEqual(norm.dtype, np.dtype('float64'))
+ assert_(norm.dtype == np.dtype('float64'))
norm = linalg.norm(testvector, ord=1)
assert_array_equal(norm, [0, 1])
- self.assertNotEqual(norm.dtype, np.dtype('float64'))
+ assert_(norm.dtype != np.dtype('float64'))
norm = linalg.norm(testvector, ord=2)
assert_array_equal(norm, [0, 1])
- self.assertEqual(norm.dtype, np.dtype('float64'))
+ assert_(norm.dtype == np.dtype('float64'))
- self.assertRaises(ValueError, linalg.norm, testvector, ord='fro')
- self.assertRaises(ValueError, linalg.norm, testvector, ord='nuc')
- self.assertRaises(ValueError, linalg.norm, testvector, ord=np.inf)
- self.assertRaises(ValueError, linalg.norm, testvector, ord=-np.inf)
+ assert_raises(ValueError, linalg.norm, testvector, ord='fro')
+ assert_raises(ValueError, linalg.norm, testvector, ord='nuc')
+ assert_raises(ValueError, linalg.norm, testvector, ord=np.inf)
+ assert_raises(ValueError, linalg.norm, testvector, ord=-np.inf)
with warnings.catch_warnings():
warnings.simplefilter("error", DeprecationWarning)
- self.assertRaises((AttributeError, DeprecationWarning),
+ assert_raises((AttributeError, DeprecationWarning),
linalg.norm, testvector, ord=0)
- self.assertRaises(ValueError, linalg.norm, testvector, ord=-1)
- self.assertRaises(ValueError, linalg.norm, testvector, ord=-2)
+ assert_raises(ValueError, linalg.norm, testvector, ord=-1)
+ assert_raises(ValueError, linalg.norm, testvector, ord=-2)
testmatrix = np.array([[np.array([0, 1]), 0, 0],
[0, 0, 0]], dtype=object)
norm = linalg.norm(testmatrix)
assert_array_equal(norm, [0, 1])
- self.assertEqual(norm.dtype, np.dtype('float64'))
+ assert_(norm.dtype == np.dtype('float64'))
norm = linalg.norm(testmatrix, ord='fro')
assert_array_equal(norm, [0, 1])
- self.assertEqual(norm.dtype, np.dtype('float64'))
-
- self.assertRaises(TypeError, linalg.norm, testmatrix, ord='nuc')
- self.assertRaises(ValueError, linalg.norm, testmatrix, ord=np.inf)
- self.assertRaises(ValueError, linalg.norm, testmatrix, ord=-np.inf)
- self.assertRaises(ValueError, linalg.norm, testmatrix, ord=0)
- self.assertRaises(ValueError, linalg.norm, testmatrix, ord=1)
- self.assertRaises(ValueError, linalg.norm, testmatrix, ord=-1)
- self.assertRaises(TypeError, linalg.norm, testmatrix, ord=2)
- self.assertRaises(TypeError, linalg.norm, testmatrix, ord=-2)
- self.assertRaises(ValueError, linalg.norm, testmatrix, ord=3)
+ assert_(norm.dtype == np.dtype('float64'))
+
+ assert_raises(TypeError, linalg.norm, testmatrix, ord='nuc')
+ assert_raises(ValueError, linalg.norm, testmatrix, ord=np.inf)
+ assert_raises(ValueError, linalg.norm, testmatrix, ord=-np.inf)
+ assert_raises(ValueError, linalg.norm, testmatrix, ord=0)
+ assert_raises(ValueError, linalg.norm, testmatrix, ord=1)
+ assert_raises(ValueError, linalg.norm, testmatrix, ord=-1)
+ assert_raises(TypeError, linalg.norm, testmatrix, ord=2)
+ assert_raises(TypeError, linalg.norm, testmatrix, ord=-2)
+ assert_raises(ValueError, linalg.norm, testmatrix, ord=3)
if __name__ == '__main__':