diff options
| author | xoviat <xoviat@users.noreply.github.com> | 2017-09-09 10:08:50 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-09 10:08:50 -0500 |
| commit | 0957a1fa0afa05d0d8a1a4f54efed46b8a81640b (patch) | |
| tree | b0e5affd128bc5a70aae913cc3cf4afb73ed0fa6 /numpy/testing | |
| parent | 06b5318a09b6173ea281f47f3d7eb584168f4e4e (diff) | |
| download | numpy-0957a1fa0afa05d0d8a1a4f54efed46b8a81640b.tar.gz | |
TST: utils: fix test_error_msg
Allow the error message to contain "large" arrays.
Diffstat (limited to 'numpy/testing')
| -rw-r--r-- | numpy/testing/tests/test_utils.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index c32afbf3a..88439bff2 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -263,21 +263,22 @@ class TestEqual(TestArrayEqual): self._assert_func(x, x) self._test_not_equal(x, y) - @dec.knownfailureif(sys.version_info < (3, 0), - msg="Error message different on Python 2") def test_error_message(self): try: self._assert_func(np.array([1, 2]), np.matrix([1, 2])) except AssertionError as e: - self.assertEqual( - str(e), - "\nArrays are not equal\n\n" + msg = str(e) + msg2 = msg.replace("shapes (2,), (1, 2)", "shapes (2L,), (1L, 2L)") + msg_reference = "\nArrays are not equal\n\n" "(shapes (2,), (1, 2) mismatch)\n" " x: array([1, 2])\n" " y: [repr failed for <matrix>: The truth value of an array " "with more than one element is ambiguous. Use a.any() or " - "a.all()]") - + "a.all()]" + try: + self.assertEqual(msg, msg_reference) + except AssertionError: + self.assertEqual(msg2, msg_reference) class TestArrayAlmostEqual(_GenericTest, unittest.TestCase): |
