summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@gmail.com>2018-12-05 10:01:47 -0800
committerGitHub <noreply@github.com>2018-12-05 10:01:47 -0800
commit8a115731966db1d723d03b4b599a5f3587edc94b (patch)
tree71fcbd23988350d8b07ffb3607152a1fb7be4e69 /numpy/lib/tests
parent9d416356baf4a653b2c647a921ae24ba7d39e8df (diff)
downloadnumpy-8a115731966db1d723d03b4b599a5f3587edc94b.tar.gz
ENH: implement matmul on NDArrayOperatorsMixin (#12488)
* ENH: implement matmul on NDArrayOperatorsMixin * MAINT: remove unnecessary pytest import
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_mixins.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_mixins.py b/numpy/lib/tests/test_mixins.py
index f2d915502..3dd5346b6 100644
--- a/numpy/lib/tests/test_mixins.py
+++ b/numpy/lib/tests/test_mixins.py
@@ -199,6 +199,17 @@ class TestNDArrayOperatorsMixin(object):
err_msg = 'failed for operator {}'.format(op)
_assert_equal_type_and_value(expected, actual, err_msg=err_msg)
+ def test_matmul(self):
+ array = np.array([1, 2], dtype=np.float64)
+ 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))
+
def test_ufunc_at(self):
array = ArrayLike(np.array([1, 2, 3, 4]))
assert_(np.negative.at(array, np.array([0, 1])) is None)