diff options
Diffstat (limited to 'numpy/lib/tests/test_mixins.py')
-rw-r--r-- | numpy/lib/tests/test_mixins.py | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/numpy/lib/tests/test_mixins.py b/numpy/lib/tests/test_mixins.py index 3dd5346b6..632058763 100644 --- a/numpy/lib/tests/test_mixins.py +++ b/numpy/lib/tests/test_mixins.py @@ -1,16 +1,10 @@ -from __future__ import division, absolute_import, print_function - import numbers import operator -import sys import numpy as np from numpy.testing import assert_, assert_equal, assert_raises -PY2 = sys.version_info.major < 3 - - # NOTE: This class should be kept as an exact copy of the example from the # docstring for NDArrayOperatorsMixin. @@ -86,7 +80,6 @@ _ALL_BINARY_OPERATORS = [ operator.mul, operator.truediv, operator.floordiv, - # TODO: test div on Python 2, only operator.mod, divmod, pow, @@ -98,7 +91,7 @@ _ALL_BINARY_OPERATORS = [ ] -class TestNDArrayOperatorsMixin(object): +class TestNDArrayOperatorsMixin: def test_array_like_add(self): @@ -128,7 +121,7 @@ class TestNDArrayOperatorsMixin(object): def test_opt_out(self): - class OptOut(object): + class OptOut: """Object that opts out of __array_ufunc__.""" __array_ufunc__ = None @@ -204,11 +197,10 @@ class TestNDArrayOperatorsMixin(object): array_like = ArrayLike(array) expected = ArrayLike(np.float64(5)) _assert_equal_type_and_value(expected, np.matmul(array_like, array)) - if not PY2: - _assert_equal_type_and_value( - expected, operator.matmul(array_like, array)) - _assert_equal_type_and_value( - expected, operator.matmul(array, array_like)) + _assert_equal_type_and_value( + expected, operator.matmul(array_like, array)) + _assert_equal_type_and_value( + expected, operator.matmul(array, array_like)) def test_ufunc_at(self): array = ArrayLike(np.array([1, 2, 3, 4])) |