diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-07-17 10:38:35 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2017-07-17 11:57:52 -0600 |
commit | 5381c68ec30e43830290d210362adc4297f96902 (patch) | |
tree | 69d73017639c79ea3d29dc818a60137f8a63ee77 /numpy/matrixlib | |
parent | 110825244a1555f594b585c72568084f1863ca1b (diff) | |
download | numpy-5381c68ec30e43830290d210362adc4297f96902.tar.gz |
TST: Remove unittest dependencies in matrixlib/tests.
Diffstat (limited to 'numpy/matrixlib')
-rw-r--r-- | numpy/matrixlib/tests/test_defmatrix.py | 29 | ||||
-rw-r--r-- | numpy/matrixlib/tests/test_multiarray.py | 4 | ||||
-rw-r--r-- | numpy/matrixlib/tests/test_numeric.py | 4 | ||||
-rw-r--r-- | numpy/matrixlib/tests/test_regression.py | 12 |
4 files changed, 25 insertions, 24 deletions
diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py index fd36d7770..e4c3c49fb 100644 --- a/numpy/matrixlib/tests/test_defmatrix.py +++ b/numpy/matrixlib/tests/test_defmatrix.py @@ -5,13 +5,13 @@ import collections import numpy as np from numpy import matrix, asmatrix, bmat from numpy.testing import ( - TestCase, run_module_suite, assert_, assert_equal, assert_almost_equal, + run_module_suite, assert_, assert_equal, assert_almost_equal, assert_array_equal, assert_array_almost_equal, assert_raises ) from numpy.matrixlib.defmatrix import matrix_power from numpy.matrixlib import mat -class TestCtor(TestCase): +class TestCtor(object): def test_basic(self): A = np.array([[1, 2], [3, 4]]) mA = matrix(A) @@ -58,7 +58,7 @@ class TestCtor(TestCase): assert_(np.all(b2 == mixresult)) -class TestProperties(TestCase): +class TestProperties(object): def test_sum(self): """Test whether matrix.sum(axis=1) preserves orientation. Fails in NumPy <= 0.9.6.2127. @@ -191,7 +191,7 @@ class TestProperties(TestCase): B = matrix([[True], [True], [False]]) assert_array_equal(A, B) -class TestCasting(TestCase): +class TestCasting(object): def test_basic(self): A = np.arange(100).reshape(10, 10) mA = matrix(A) @@ -210,7 +210,7 @@ class TestCasting(TestCase): assert_(np.all(mA != mB)) -class TestAlgebra(TestCase): +class TestAlgebra(object): def test_basic(self): import numpy.linalg as linalg @@ -271,7 +271,7 @@ class TestAlgebra(TestCase): self.fail("matrix.__mul__ with non-numeric object doesn't raise" "a TypeError") -class TestMatrixReturn(TestCase): +class TestMatrixReturn(object): def test_instance_methods(self): a = matrix([1.0], dtype='f8') methodargs = { @@ -313,7 +313,7 @@ class TestMatrixReturn(TestCase): assert_(type(d) is np.ndarray) -class TestIndexing(TestCase): +class TestIndexing(object): def test_basic(self): x = asmatrix(np.zeros((3, 2), float)) y = np.zeros((3, 1), float) @@ -322,9 +322,8 @@ class TestIndexing(TestCase): assert_equal(x, [[0, 1], [0, 0], [0, 0]]) -class TestNewScalarIndexing(TestCase): - def setUp(self): - self.a = matrix([[1, 2], [3, 4]]) +class TestNewScalarIndexing(object): + a = matrix([[1, 2], [3, 4]]) def test_dimesions(self): a = self.a @@ -390,7 +389,7 @@ class TestNewScalarIndexing(TestCase): assert_array_equal(x[[2, 1, 0],:], x[::-1,:]) -class TestPower(TestCase): +class TestPower(object): def test_returntype(self): a = np.array([[0, 1], [0, 0]]) assert_(type(matrix_power(a, 2)) is np.ndarray) @@ -401,10 +400,10 @@ class TestPower(TestCase): assert_array_equal(matrix_power([[0, 1], [0, 0]], 2), [[0, 0], [0, 0]]) -class TestShape(TestCase): - def setUp(self): - self.a = np.array([[1], [2]]) - self.m = matrix([[1], [2]]) +class TestShape(object): + + a = np.array([[1], [2]]) + m = matrix([[1], [2]]) def test_shape(self): assert_equal(self.a.shape, (2, 1)) diff --git a/numpy/matrixlib/tests/test_multiarray.py b/numpy/matrixlib/tests/test_multiarray.py index d27e24ec9..bf891a196 100644 --- a/numpy/matrixlib/tests/test_multiarray.py +++ b/numpy/matrixlib/tests/test_multiarray.py @@ -2,10 +2,10 @@ from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import ( - TestCase, run_module_suite, assert_, assert_equal, assert_array_equal + run_module_suite, assert_, assert_equal, assert_array_equal ) -class TestView(TestCase): +class TestView(object): def test_type(self): x = np.array([1, 2, 3]) assert_(isinstance(x.view(np.matrix), np.matrix)) diff --git a/numpy/matrixlib/tests/test_numeric.py b/numpy/matrixlib/tests/test_numeric.py index 28329da39..b826b8e81 100644 --- a/numpy/matrixlib/tests/test_numeric.py +++ b/numpy/matrixlib/tests/test_numeric.py @@ -1,9 +1,9 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import assert_equal, TestCase, run_module_suite +from numpy.testing import assert_equal, run_module_suite -class TestDot(TestCase): +class TestDot(object): def test_matscalar(self): b1 = np.matrix(np.ones((3, 3), dtype=complex)) assert_equal(b1*1.0, b1) diff --git a/numpy/matrixlib/tests/test_regression.py b/numpy/matrixlib/tests/test_regression.py index 0839fbf28..b681374f2 100644 --- a/numpy/matrixlib/tests/test_regression.py +++ b/numpy/matrixlib/tests/test_regression.py @@ -1,11 +1,13 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import TestCase, run_module_suite, assert_, assert_equal +from numpy.testing import ( + run_module_suite, assert_, assert_equal, assert_raises + ) rlevel = 1 -class TestRegression(TestCase): +class TestRegression(object): def test_kron_matrix(self, level=rlevel): # Ticket #71 x = np.matrix('[1 0; 1 0]') @@ -25,13 +27,13 @@ class TestRegression(TestCase): def mul(): np.mat(np.eye(2))*np.ones(2) - self.assertRaises(ValueError, mul) + assert_raises(ValueError, mul) def test_matrix_std_argmax(self,level=rlevel): # Ticket #83 x = np.asmatrix(np.random.uniform(0, 1, (3, 3))) - self.assertEqual(x.std().shape, ()) - self.assertEqual(x.argmax().shape, ()) + assert_equal(x.std().shape, ()) + assert_equal(x.argmax().shape, ()) if __name__ == "__main__": run_module_suite() |