diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-01-05 00:53:30 -0500 |
---|---|---|
committer | Warren Weckesser <warren.weckesser@gmail.com> | 2020-01-05 00:53:30 -0500 |
commit | c31cc36a8a814ed4844a2a553454185601914a5a (patch) | |
tree | adb28a762dc0985eed669db75b564b3f5c3bfbcc /numpy/matrixlib/tests/test_defmatrix.py | |
parent | c1f1bc9ce8e4e2936e80d9bfafc3d8e03237a84b (diff) | |
download | numpy-c31cc36a8a814ed4844a2a553454185601914a5a.tar.gz |
MAINT: Remove implicit inheritance from object class (#15236)
Inheriting from object was necessary for Python 2 compatibility to use
new-style classes. In Python 3, this is unnecessary as there are no
old-style classes.
Dropping the object is more idiomatic Python.
Diffstat (limited to 'numpy/matrixlib/tests/test_defmatrix.py')
-rw-r--r-- | numpy/matrixlib/tests/test_defmatrix.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py index 68151833b..a8070898f 100644 --- a/numpy/matrixlib/tests/test_defmatrix.py +++ b/numpy/matrixlib/tests/test_defmatrix.py @@ -14,7 +14,7 @@ from numpy.testing import ( from numpy.linalg import matrix_power from numpy.matrixlib import mat -class TestCtor(object): +class TestCtor: def test_basic(self): A = np.array([[1, 2], [3, 4]]) mA = matrix(A) @@ -61,7 +61,7 @@ class TestCtor(object): assert_(np.all(b2 == mixresult)) -class TestProperties(object): +class TestProperties: def test_sum(self): """Test whether matrix.sum(axis=1) preserves orientation. Fails in NumPy <= 0.9.6.2127. @@ -194,7 +194,7 @@ class TestProperties(object): B = matrix([[True], [True], [False]]) assert_array_equal(A, B) -class TestCasting(object): +class TestCasting: def test_basic(self): A = np.arange(100).reshape(10, 10) mA = matrix(A) @@ -213,7 +213,7 @@ class TestCasting(object): assert_(np.all(mA != mB)) -class TestAlgebra(object): +class TestAlgebra: def test_basic(self): import numpy.linalg as linalg @@ -272,7 +272,7 @@ class TestAlgebra(object): A*object() -class TestMatrixReturn(object): +class TestMatrixReturn: def test_instance_methods(self): a = matrix([1.0], dtype='f8') methodargs = { @@ -314,7 +314,7 @@ class TestMatrixReturn(object): assert_(type(d) is np.ndarray) -class TestIndexing(object): +class TestIndexing: def test_basic(self): x = asmatrix(np.zeros((3, 2), float)) y = np.zeros((3, 1), float) @@ -323,7 +323,7 @@ class TestIndexing(object): assert_equal(x, [[0, 1], [0, 0], [0, 0]]) -class TestNewScalarIndexing(object): +class TestNewScalarIndexing: a = matrix([[1, 2], [3, 4]]) def test_dimesions(self): @@ -390,7 +390,7 @@ class TestNewScalarIndexing(object): assert_array_equal(x[[2, 1, 0],:], x[::-1,:]) -class TestPower(object): +class TestPower: def test_returntype(self): a = np.array([[0, 1], [0, 0]]) assert_(type(matrix_power(a, 2)) is np.ndarray) @@ -401,7 +401,7 @@ class TestPower(object): assert_array_equal(matrix_power([[0, 1], [0, 0]], 2), [[0, 0], [0, 0]]) -class TestShape(object): +class TestShape: a = np.array([[1], [2]]) m = matrix([[1], [2]]) |