summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/testing/tests/test_utils.py')
-rw-r--r--numpy/testing/tests/test_utils.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index f9821f28d..aa0a2669f 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -288,22 +288,24 @@ class TestAlmostEqual(_GenericTest, unittest.TestCase):
y = np.array([1.00000000002, 2.00000000003, 3.00004])
# test with a different amount of decimal digits
- b = ('\nArrays are not almost equal to 12 decimals\n\n(mismatch '
- '100.0%)\n x: array([ 1.00000000001, 2.00000000002, 3.00003 '
+ # note that we only check for the formatting of the arrays themselves
+ b = ('x: array([ 1.00000000001, 2.00000000002, 3.00003 '
' ])\n y: array([ 1.00000000002, 2.00000000003, 3.00004 ])')
try:
self._assert_func(x, y, decimal=12)
except AssertionError as e:
- self.assertEqual(str(e), b)
+ # remove anything that's not the array string
+ self.assertEqual(str(e).split('%)\n ')[1], b)
# with the default value of decimal digits, only the 3rd element differs
- b = ('\nArrays are not almost equal to 7 decimals\n\n(mismatch '
- '33.3333333333%)\n x: array([ 1. , 2. , 3.00003])\n y: '
- 'array([ 1. , 2. , 3.00004])')
+ # note that we only check for the formatting of the arrays themselves
+ b = ('x: array([ 1. , 2. , 3.00003])\n y: array([ 1. , '
+ '2. , 3.00004])')
try:
self._assert_func(x, y)
except AssertionError as e:
- self.assertEqual(str(e), b)
+ # remove anything that's not the array string
+ self.assertEqual(str(e).split('%)\n ')[1], b)
class TestApproxEqual(unittest.TestCase):
def setUp(self):