diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-12-06 01:10:43 -0800 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-12-06 08:53:51 -0800 |
commit | afad5902f2e5086c9c30bdad8a21561e3188d816 (patch) | |
tree | a1a2c4aeb527d6b688e92d24771b5707c807e698 /numpy/testing/tests | |
parent | 1d6be8331a3d22ae5ff6639b264b125f3bb14bd6 (diff) | |
download | numpy-afad5902f2e5086c9c30bdad8a21561e3188d816.tar.gz |
MAINT/BUG: Simplify _formatArray, fixing array_repr(matrix) in the process
Now:
* Has one recursive base case
* Is fewer lines of code
* Does not rstrip the result of format_function (none of the builtin ones have trailing spaces anyway)
* Recurses in the index, instead of the value, which handles `dtype=object` arrays without the need for the rank argument. This fixes #8442.
Diffstat (limited to 'numpy/testing/tests')
-rw-r--r-- | numpy/testing/tests/test_utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 08d67153a..77fb974cf 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -296,11 +296,13 @@ class TestEqual(TestArrayEqual): (shapes (2,), (1, 2) mismatch) x: array([1, 2]) - y: [repr failed for <matrix>: %d format: a number is required, not matrix]""") + y: matrix([[1, 2]])""") try: self.assertEqual(msg, msg_reference) except AssertionError: self.assertEqual(msg2, msg_reference) + else: + raise AssertionError("Did not raise") class TestArrayAlmostEqual(_GenericTest, unittest.TestCase): |