diff options
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/mixins.py | 5 | ||||
-rw-r--r-- | numpy/lib/tests/test_mixins.py | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/numpy/lib/mixins.py b/numpy/lib/mixins.py index b5231e372..bbeed1437 100644 --- a/numpy/lib/mixins.py +++ b/numpy/lib/mixins.py @@ -70,8 +70,8 @@ class NDArrayOperatorsMixin(object): implement. This class does not yet implement the special operators corresponding - to ``divmod``, unary ``+`` or ``matmul`` (``@``), because these operation - do not yet have corresponding NumPy ufuncs. + to ``divmod`` or ``matmul`` (``@``), because these operation do not yet + have corresponding NumPy ufuncs. It is useful for writing classes that do not inherit from `numpy.ndarray`, but that should support arithmetic and numpy universal functions like @@ -174,5 +174,6 @@ class NDArrayOperatorsMixin(object): # unary methods __neg__ = _unary_method(um.negative, 'neg') + __pos__ = _unary_method(um.positive, 'pos') __abs__ = _unary_method(um.absolute, 'abs') __invert__ = _unary_method(um.invert, 'invert') diff --git a/numpy/lib/tests/test_mixins.py b/numpy/lib/tests/test_mixins.py index 57c4a4cd8..287d4ed29 100644 --- a/numpy/lib/tests/test_mixins.py +++ b/numpy/lib/tests/test_mixins.py @@ -143,7 +143,7 @@ class TestNDArrayOperatorsMixin(TestCase): array = np.array([-1, 0, 1, 2]) array_like = ArrayLike(array) for op in [operator.neg, - # pos is not yet implemented + operator.pos, abs, operator.invert]: _assert_equal_type_and_value(op(array_like), ArrayLike(op(array))) |