Skip to content

Commit ac40c2e

Browse files
committed
MAINT: revert changes, so all tests pass for warning contexts
1 parent e8dda96 commit ac40c2e

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

numpy/testing/tests/test_utils.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,11 +1310,12 @@ def test_clear_and_catch_warnings():
13101310
warnings.simplefilter('ignore')
13111311
warnings.warn('Another warning')
13121312
assert_warn_len_equal(my_mod, 2)
1313-
# Another warning, no module spec does add to warnings dict
1313+
1314+
# Another warning, no module spec it clears up registry
13141315
with clear_and_catch_warnings():
13151316
warnings.simplefilter('ignore')
13161317
warnings.warn('Another warning')
1317-
assert_warn_len_equal(my_mod, 2)
1318+
assert_warn_len_equal(my_mod, 0)
13181319

13191320

13201321
def test_suppress_warnings_module():
@@ -1356,15 +1357,11 @@ def warn(arr):
13561357
warnings.warn('Some warning')
13571358
assert_warn_len_equal(my_mod, 0)
13581359

1359-
# Manually adding two warnings to the registry:
1360-
my_mod.__warningregistry__ = {'warning1': 1,
1361-
'warning2': 2}
1362-
1363-
# Without specified modules, don't clear warnings during context
1360+
# Without specified modules
13641361
with suppress_warnings():
13651362
warnings.simplefilter('ignore')
13661363
warnings.warn('Some warning')
1367-
assert_warn_len_equal(my_mod, 2)
1364+
assert_warn_len_equal(my_mod, 0)
13681365

13691366

13701367
def test_suppress_warnings_type():
@@ -1388,15 +1385,11 @@ def test_suppress_warnings_type():
13881385
warnings.warn('Some warning')
13891386
assert_warn_len_equal(my_mod, 0)
13901387

1391-
# Manually adding two warnings to the registry:
1392-
my_mod.__warningregistry__ = {'warning1': 1,
1393-
'warning2': 2}
1394-
1395-
# Without specified modules, don't clear warnings during context
1388+
# Without specified modules
13961389
with suppress_warnings():
13971390
warnings.simplefilter('ignore')
13981391
warnings.warn('Some warning')
1399-
assert_warn_len_equal(my_mod, 2)
1392+
assert_warn_len_equal(my_mod, 0)
14001393

14011394

14021395
def test_suppress_warnings_decorate_no_record():

0 commit comments

Comments
 (0)