summaryrefslogtreecommitdiff
path: root/numpy/matrixlib/tests/test_defmatrix.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-05-25 23:07:21 -0700
committerGitHub <noreply@github.com>2018-05-25 23:07:21 -0700
commita10b4270d4b3f538254698874560d645c0525dc5 (patch)
treee8ff62b91d0477b56042b879d489e59ba807fed7 /numpy/matrixlib/tests/test_defmatrix.py
parent0addc016ba7000b27509663f4f489c6eb1838056 (diff)
parentc1fc882277bcec42e11f67c6eced43d68cec4d7a (diff)
downloadnumpy-a10b4270d4b3f538254698874560d645c0525dc5.tar.gz
Merge branch 'master' into force-tuple
Diffstat (limited to 'numpy/matrixlib/tests/test_defmatrix.py')
-rw-r--r--numpy/matrixlib/tests/test_defmatrix.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py
index 77f262031..d160490b3 100644
--- a/numpy/matrixlib/tests/test_defmatrix.py
+++ b/numpy/matrixlib/tests/test_defmatrix.py
@@ -1,14 +1,19 @@
from __future__ import division, absolute_import, print_function
-import collections
+try:
+ # Accessing collections abstract classes from collections
+ # has been deprecated since Python 3.3
+ import collections.abc as collections_abc
+except ImportError:
+ import collections as collections_abc
import numpy as np
from numpy import matrix, asmatrix, bmat
from numpy.testing import (
- 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
+ assert_, assert_equal, assert_almost_equal, assert_array_equal,
+ assert_array_almost_equal, assert_raises
+ )
+from numpy.linalg import matrix_power
from numpy.matrixlib import mat
class TestCtor(object):
@@ -302,7 +307,7 @@ class TestMatrixReturn(object):
if attrib.startswith('_') or attrib in excluded_methods:
continue
f = getattr(a, attrib)
- if isinstance(f, collections.Callable):
+ if isinstance(f, collections_abc.Callable):
# reset contents of a
a.astype('f8')
a.fill(1.0)
@@ -453,7 +458,3 @@ class TestShape(object):
def test_matrix_memory_sharing(self):
assert_(np.may_share_memory(self.m, self.m.ravel()))
assert_(not np.may_share_memory(self.m, self.m.flatten()))
-
-
-if __name__ == "__main__":
- run_module_suite()