diff options
author | Meekail Zain <34613774+Micky774@users.noreply.github.com> | 2022-06-13 16:55:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 13:55:04 -0700 |
commit | cadfd83cb1e1df466eb91eb9c38dd2775455d64d (patch) | |
tree | 6ed4c3805fe0a5861345df3c8e56c5479d350524 /numpy/typing | |
parent | 80e55b2dcecbd1475f74324847fa806d8159b9da (diff) | |
download | numpy-cadfd83cb1e1df466eb91eb9c38dd2775455d64d.tar.gz |
ENH: issue overflow warning when using `abs` on `np.int8(-128)` (#21648)
Checks condition a == NPY_MIN_@NAME@ to determine whether an overflow error has occurred for np.int8 type. See #21289 and #21188 (comment) for reference.
This also adds error integer overflow handling to the `-scalar` paths and "activates" a test for the unsigned versions.
A few tests are skipped, because the tests were buggy (they never ran). These paths require followups to fix.
Diffstat (limited to 'numpy/typing')
-rw-r--r-- | numpy/typing/tests/data/pass/arithmetic.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/typing/tests/data/pass/arithmetic.py b/numpy/typing/tests/data/pass/arithmetic.py index 4ed69c923..07a990127 100644 --- a/numpy/typing/tests/data/pass/arithmetic.py +++ b/numpy/typing/tests/data/pass/arithmetic.py @@ -2,6 +2,7 @@ from __future__ import annotations from typing import Any import numpy as np +import pytest c16 = np.complex128(1) f8 = np.float64(1) @@ -330,8 +331,9 @@ AR_O **= AR_LIKE_O -f4 -i8 -i4 --u8 --u4 +with pytest.warns(RuntimeWarning): + -u8 + -u4 -td -AR_f |