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/tests/test_defmatrix.py | |
parent | 110825244a1555f594b585c72568084f1863ca1b (diff) | |
download | numpy-5381c68ec30e43830290d210362adc4297f96902.tar.gz |
TST: Remove unittest dependencies in matrixlib/tests.
Diffstat (limited to 'numpy/matrixlib/tests/test_defmatrix.py')
-rw-r--r-- | numpy/matrixlib/tests/test_defmatrix.py | 29 |
1 files changed, 14 insertions, 15 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)) |