diff options
author | Simon Surland Andersen <syrlander98@gmail.com> | 2022-02-08 14:43:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 07:43:36 -0600 |
commit | f69ddd7111048111a7e486a2d7d008bd231af33d (patch) | |
tree | cc3e7ca5e30ff8b6668a7311be8eb24a12ff7d33 /numpy/testing/tests | |
parent | 4b3ddd74610d1975e0d0eb9c32df2a2d54c8dafd (diff) | |
download | numpy-f69ddd7111048111a7e486a2d7d008bd231af33d.tar.gz |
ENH: Suppress over-/underflow RuntimeWarning in assert_array_equal (#21003)
* TST: Test suppression of asset_array_equal RuntimeWarning See #18992
* ENH: Suppress over-/underflow warnings on asset_array_equal - Closes #18992
* MAINT: Resolve linting issues of prior commit
* MAINT: Simplified ignore and test case of asset_array_equal
* MAINT: Removed unused import in test_utils.py
Diffstat (limited to 'numpy/testing/tests')
-rw-r--r-- | numpy/testing/tests/test_utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 31d2cdc76..919ca751f 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -207,6 +207,14 @@ class TestArrayEqual(_GenericTest): self._test_not_equal(a, b) self._test_not_equal(b, a) + def test_suppress_overflow_warnings(self): + # Based on issue #18992 + with pytest.raises(AssertionError): + with np.errstate(all="raise"): + np.testing.assert_array_equal( + np.array([1, 2, 3], np.float32), + np.array([1, 1e-40, 3], np.float32)) + class TestBuildErrorMessage: |