summaryrefslogtreecommitdiff
path: root/numpy/matrixlib
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-01-23 14:28:59 +1100
committerGitHub <noreply@github.com>2020-01-23 14:28:59 +1100
commit388e8197e15403345950edc23ae5fc7a3cb0f644 (patch)
treeb2531ff0067ad6b60227fb7ebcec4421bffe28e6 /numpy/matrixlib
parent54f0f6e9aeff673551ccfa272fa82a27edb89552 (diff)
parent6737f241454688f6ea59a883f6c6e3fe8eff8e8b (diff)
downloadnumpy-388e8197e15403345950edc23ae5fc7a3cb0f644.tar.gz
Merge pull request #15379 from sethtroisi/misc_cleanups3
MAINT: Python2 Cleanups
Diffstat (limited to 'numpy/matrixlib')
-rw-r--r--numpy/matrixlib/tests/test_interaction.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/numpy/matrixlib/tests/test_interaction.py b/numpy/matrixlib/tests/test_interaction.py
index 608416ed7..5154bd621 100644
--- a/numpy/matrixlib/tests/test_interaction.py
+++ b/numpy/matrixlib/tests/test_interaction.py
@@ -324,24 +324,17 @@ class TestConcatenatorMatrix:
def test_array_equal_error_message_matrix():
# 2018-04-29: moved here from testing.tests.test_utils.
- try:
+ with pytest.raises(AssertionError) as exc_info:
assert_equal(np.array([1, 2]), np.matrix([1, 2]))
- except AssertionError as e:
- msg = str(e)
- msg2 = msg.replace("shapes (2L,), (1L, 2L)", "shapes (2,), (1, 2)")
- msg_reference = textwrap.dedent("""\
-
- Arrays are not equal
-
- (shapes (2,), (1, 2) mismatch)
- x: array([1, 2])
- y: matrix([[1, 2]])""")
- try:
- assert_equal(msg, msg_reference)
- except AssertionError:
- assert_equal(msg2, msg_reference)
- else:
- raise AssertionError("Did not raise")
+ msg = str(exc_info.value)
+ msg_reference = textwrap.dedent("""\
+
+ Arrays are not equal
+
+ (shapes (2,), (1, 2) mismatch)
+ x: array([1, 2])
+ y: matrix([[1, 2]])""")
+ assert_equal(msg, msg_reference)
def test_array_almost_equal_matrix():