summaryrefslogtreecommitdiff
path: root/numpy/matrixlib/tests/test_defmatrix.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-08-01 17:39:11 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-08-05 21:49:34 -0500
commit6a119c982463097aebc8d004fc731b424721a650 (patch)
tree581c81d6b36517f6e0cf4b3ad8a41f21aaed9b97 /numpy/matrixlib/tests/test_defmatrix.py
parentbfe43b26969231cfe8196868280c07f0c0aa8f50 (diff)
downloadnumpy-6a119c982463097aebc8d004fc731b424721a650.tar.gz
BUG: Be explicit about allowing all integer types in matrix exponentiation
Fixes gh-9506, unsigned exponentiation
Diffstat (limited to 'numpy/matrixlib/tests/test_defmatrix.py')
-rw-r--r--numpy/matrixlib/tests/test_defmatrix.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py
index e4c3c49fb..77f262031 100644
--- a/numpy/matrixlib/tests/test_defmatrix.py
+++ b/numpy/matrixlib/tests/test_defmatrix.py
@@ -249,6 +249,12 @@ class TestAlgebra(object):
assert_array_almost_equal(m4, np.dot(m2, m2))
assert_array_almost_equal(np.dot(mi, m), np.eye(2))
+ def test_scalar_type_pow(self):
+ m = matrix([[1, 2], [3, 4]])
+ for scalar_t in [np.int8, np.uint8]:
+ two = scalar_t(2)
+ assert_array_almost_equal(m ** 2, m ** two)
+
def test_notimplemented(self):
'''Check that 'not implemented' operations produce a failure.'''
A = matrix([[1., 2.],