summaryrefslogtreecommitdiff
path: root/numpy/testing
diff options
context:
space:
mode:
authorBrigitta Sipőcz <bsipocz@gmail.com>2022-05-20 20:45:54 -0700
committerBrigitta Sipőcz <bsipocz@gmail.com>2022-05-23 09:29:59 -0700
commitac40c2ea38021ee57a8c6261cfc9b792bc51970b (patch)
treecba1041dd3880bd99a50c2aac72e3c594c2c88aa /numpy/testing
parente8dda96dd2a50d2e23134d924cbcabd545af54a1 (diff)
downloadnumpy-ac40c2ea38021ee57a8c6261cfc9b792bc51970b.tar.gz
MAINT: revert changes, so all tests pass for warning contexts
Diffstat (limited to 'numpy/testing')
-rw-r--r--numpy/testing/tests/test_utils.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index 6fa51454f..49eeecc8e 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -1310,11 +1310,12 @@ def test_clear_and_catch_warnings():
warnings.simplefilter('ignore')
warnings.warn('Another warning')
assert_warn_len_equal(my_mod, 2)
- # Another warning, no module spec does add to warnings dict
+
+ # Another warning, no module spec it clears up registry
with clear_and_catch_warnings():
warnings.simplefilter('ignore')
warnings.warn('Another warning')
- assert_warn_len_equal(my_mod, 2)
+ assert_warn_len_equal(my_mod, 0)
def test_suppress_warnings_module():
@@ -1356,15 +1357,11 @@ def test_suppress_warnings_module():
warnings.warn('Some warning')
assert_warn_len_equal(my_mod, 0)
- # Manually adding two warnings to the registry:
- my_mod.__warningregistry__ = {'warning1': 1,
- 'warning2': 2}
-
- # Without specified modules, don't clear warnings during context
+ # Without specified modules
with suppress_warnings():
warnings.simplefilter('ignore')
warnings.warn('Some warning')
- assert_warn_len_equal(my_mod, 2)
+ assert_warn_len_equal(my_mod, 0)
def test_suppress_warnings_type():
@@ -1388,15 +1385,11 @@ def test_suppress_warnings_type():
warnings.warn('Some warning')
assert_warn_len_equal(my_mod, 0)
- # Manually adding two warnings to the registry:
- my_mod.__warningregistry__ = {'warning1': 1,
- 'warning2': 2}
-
- # Without specified modules, don't clear warnings during context
+ # Without specified modules
with suppress_warnings():
warnings.simplefilter('ignore')
warnings.warn('Some warning')
- assert_warn_len_equal(my_mod, 2)
+ assert_warn_len_equal(my_mod, 0)
def test_suppress_warnings_decorate_no_record():