diff options
author | Mark Harfouche <mark.harfouche@gmail.com> | 2022-06-18 22:31:09 -0400 |
---|---|---|
committer | Mark Harfouche <mark.harfouche@gmail.com> | 2022-06-29 22:59:48 -0400 |
commit | 162b63b4ee2f9567c638699a92fc8477e281c924 (patch) | |
tree | b8dabdd6ace08d81e1ae46dbc48b8969073c48a3 /numpy/testing/_private/utils.py | |
parent | 57d04d883e874c611091933c4c36e1cd43ea0e04 (diff) | |
download | numpy-162b63b4ee2f9567c638699a92fc8477e281c924.tar.gz |
BUG: Ensure that assertion of unsigned dtypes does not return results
that wrapped around.
Diffstat (limited to 'numpy/testing/_private/utils.py')
-rw-r--r-- | numpy/testing/_private/utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index e4f8b9892..b6afdd149 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -814,6 +814,9 @@ def assert_array_compare(comparison, x, y, err_msg='', verbose=True, header='', # ignore errors for non-numeric types with contextlib.suppress(TypeError): error = abs(x - y) + if np.issubdtype(x.dtype, np.unsignedinteger): + error2 = abs(y - x) + np.minimum(error, error2, out=error) max_abs_error = max(error) if getattr(error, 'dtype', object_) == object_: remarks.append('Max absolute difference: ' |