diff options
author | mattip <matti.picus@gmail.com> | 2020-02-28 15:13:14 +0200 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2020-02-28 15:13:14 +0200 |
commit | 6dc191c2cf11b40a656cc360a355cc1d2700ba78 (patch) | |
tree | cd4d816d771b22950ea6e60fe0be88df045a6c35 | |
parent | 7eaac94d183888639422c7b55471613f1d5bce18 (diff) | |
download | numpy-6dc191c2cf11b40a656cc360a355cc1d2700ba78.tar.gz |
BUG: fix doctest exception messages
-rw-r--r-- | numpy/lib/function_base.py | 4 | ||||
-rw-r--r-- | numpy/random/_generator.pyx | 2 | ||||
-rw-r--r-- | numpy/testing/_private/utils.py | 17 |
3 files changed, 16 insertions, 7 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 2721b04dd..12320ae47 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -4654,7 +4654,9 @@ def append(arr, values, axis=None): >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) Traceback (most recent call last): ... - ValueError: all the input arrays must have same number of dimensions + ValueError: all the input arrays must have same number of dimensions, but + the array at index 0 has 2 dimension(s) and the array at index 1 has 1 + dimension(s) """ arr = asanyarray(arr) diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index f6c0c71b0..a3c2e0976 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -4337,7 +4337,7 @@ cdef class Generator: >>> rng.permutation("abc") Traceback (most recent call last): ... - numpy.AxisError: x must be an integer or at least 1-dimensional + numpy.AxisError: axis 0 is out of bounds for array of dimension 0 >>> arr = np.arange(9).reshape((3, 3)) >>> rng.permutation(arr, axis=1) diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 2842eb147..4569efa91 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -530,7 +530,8 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True): ... AssertionError: Arrays are not almost equal to 9 decimals - Mismatch: 50% + <BLANKLINE> + Mismatched elements: 1 / 2 (50%) Max absolute difference: 6.66669964e-09 Max relative difference: 2.85715698e-09 x: array([1. , 2.333333333]) @@ -904,7 +905,8 @@ def assert_array_equal(x, y, err_msg='', verbose=True): ... AssertionError: Arrays are not equal - Mismatch: 33.3% + <BLANKLINE> + Mismatched elements: 1 / 3 (33.3%) Max absolute difference: 4.4408921e-16 Max relative difference: 1.41357986e-16 x: array([1. , 3.141593, nan]) @@ -987,7 +989,8 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True): ... AssertionError: Arrays are not almost equal to 5 decimals - Mismatch: 33.3% + <BLANKLINE> + Mismatched elements: 1 / 3 (33.3%) Max absolute difference: 6.e-05 Max relative difference: 2.57136612e-05 x: array([1. , 2.33333, nan]) @@ -999,6 +1002,7 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True): ... AssertionError: Arrays are not almost equal to 5 decimals + <BLANKLINE> x and y nan location mismatch: x: array([1. , 2.33333, nan]) y: array([1. , 2.33333, 5. ]) @@ -1086,7 +1090,8 @@ def assert_array_less(x, y, err_msg='', verbose=True): ... AssertionError: Arrays are not less-ordered - Mismatch: 33.3% + <BLANKLINE> + Mismatched elements: 1 / 3 (33.3%) Max absolute difference: 1. Max relative difference: 0.5 x: array([ 1., 1., nan]) @@ -1097,7 +1102,8 @@ def assert_array_less(x, y, err_msg='', verbose=True): ... AssertionError: Arrays are not less-ordered - Mismatch: 50% + <BLANKLINE> + Mismatched elements: 1 / 2 (50%) Max absolute difference: 2. Max relative difference: 0.66666667 x: array([1., 4.]) @@ -1108,6 +1114,7 @@ def assert_array_less(x, y, err_msg='', verbose=True): ... AssertionError: Arrays are not less-ordered + <BLANKLINE> (shapes (3,), (1,) mismatch) x: array([1., 2., 3.]) y: array([4]) |