diff options
author | Frederick Lefebvre <fredlef@amazon.com> | 2018-03-14 03:33:05 +0000 |
---|---|---|
committer | fredlef <fredlef@amazon.com> | 2018-03-14 13:14:55 -0700 |
commit | 53b358ce7eddf78ac2bc22045fbe25e91e663b9a (patch) | |
tree | 37054f48b52d3725f7b1f6a840fd0f0d40ba2399 /numpy/matrixlib/tests/test_defmatrix.py | |
parent | a91f61a429e35a47f6faa025ceb862664dc12609 (diff) | |
download | numpy-53b358ce7eddf78ac2bc22045fbe25e91e663b9a.tar.gz |
TST: Import abstract classes from collections.abc
Abstract collection classes accessed from the collections module
have been deprecated since Python 3.3. They should be
accessed through collections.abc. When run with Python
3.7, the deprecation warning cause multiple tests to
fail.
Diffstat (limited to 'numpy/matrixlib/tests/test_defmatrix.py')
-rw-r--r-- | numpy/matrixlib/tests/test_defmatrix.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py index 77f262031..9575f9c8a 100644 --- a/numpy/matrixlib/tests/test_defmatrix.py +++ b/numpy/matrixlib/tests/test_defmatrix.py @@ -1,6 +1,11 @@ from __future__ import division, absolute_import, print_function -import collections +try: + # Accessing collections abstact 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 @@ -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) |