summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuveer Devulapalli <raghuveer.devulapalli@intel.com>2022-02-03 10:01:00 -0800
committerRaghuveer Devulapalli <raghuveer.devulapalli@intel.com>2022-02-03 10:01:21 -0800
commite3cb0a7206f08e5415fb0a37bfbaf634341f2144 (patch)
tree8808566f36cd28dc02b6ab0127d52a32979adba8
parent0d1d76e85f272ea845bb1a389dd12c819b185155 (diff)
downloadnumpy-e3cb0a7206f08e5415fb0a37bfbaf634341f2144.tar.gz
TST: Update exp test to check for spurious over and underflow flag
-rw-r--r--numpy/core/tests/test_umath.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 575807d89..dd0bb88ff 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -995,12 +995,13 @@ class TestExp:
class TestSpecialFloats:
def test_exp_values(self):
- x = [np.nan, np.nan, np.inf, 0.]
- y = [np.nan, -np.nan, np.inf, -np.inf]
- for dt in ['f', 'd', 'g']:
- xf = np.array(x, dtype=dt)
- yf = np.array(y, dtype=dt)
- assert_equal(np.exp(yf), xf)
+ with np.errstate(under='raise', over='raise'):
+ x = [np.nan, np.nan, np.inf, 0.]
+ y = [np.nan, -np.nan, np.inf, -np.inf]
+ for dt in ['f', 'd', 'g']:
+ xf = np.array(x, dtype=dt)
+ yf = np.array(y, dtype=dt)
+ assert_equal(np.exp(yf), xf)
# See: https://github.com/numpy/numpy/issues/19192
@pytest.mark.xfail(