diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2016-06-19 14:18:35 +0200 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2016-09-02 10:10:55 +0200 |
commit | 308161c80f4450f05f8399343034308bd18b4e1e (patch) | |
tree | ba3778d778e1222e93246ca7842e8f060e411173 /numpy/linalg/tests | |
parent | c1ddf841f6a48248b946a990ae750505b8b91686 (diff) | |
download | numpy-308161c80f4450f05f8399343034308bd18b4e1e.tar.gz |
TST: Use new warnings context manager in all tests
In some places, just remove aparently unnecessary filters.
After this, all cases of ignore filters should be removed from
the tests, making testing (even multiple runs) normally fully
predictable.
Diffstat (limited to 'numpy/linalg/tests')
-rw-r--r-- | numpy/linalg/tests/test_linalg.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py index a89378acd..a353271de 100644 --- a/numpy/linalg/tests/test_linalg.py +++ b/numpy/linalg/tests/test_linalg.py @@ -18,7 +18,7 @@ from numpy.linalg.linalg import _multi_dot_matrix_chain_order from numpy.testing import ( assert_, assert_equal, assert_raises, assert_array_equal, assert_almost_equal, assert_allclose, run_module_suite, - dec, SkipTest + dec, SkipTest, suppress_warnings ) @@ -861,8 +861,8 @@ class _TestNorm(object): assert_(issubclass(an.dtype.type, np.floating)) assert_almost_equal(an, 0.0) - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RuntimeWarning) + with suppress_warnings() as sup: + sup.filter(RuntimeWarning, "divide by zero encountered") an = norm(at, -1) assert_(issubclass(an.dtype.type, np.floating)) assert_almost_equal(an, 0.0) @@ -906,8 +906,8 @@ class _TestNorm(object): assert_(issubclass(an.dtype.type, np.floating)) assert_almost_equal(an, 2.0) - with warnings.catch_warnings(): - warnings.simplefilter("ignore", RuntimeWarning) + with suppress_warnings() as sup: + sup.filter(RuntimeWarning, "divide by zero encountered") an = norm(at, -1) assert_(issubclass(an.dtype.type, np.floating)) assert_almost_equal(an, 1.0) |