Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py
index c9d2054..71994ad 100644
--- a/Lib/test/test_symtable.py
+++ b/Lib/test/test_symtable.py
@@ -3,7 +3,6 @@
"""
import symtable
import unittest
-import warnings
from test import test_support
@@ -44,9 +43,8 @@
class SymtableTest(unittest.TestCase):
- with warnings.catch_warnings():
- # Ignore warnings about "from blank import *"
- warnings.simplefilter("ignore", SyntaxWarning)
+ with test_support.check_warnings(
+ ("import \* only allowed at module level", SyntaxWarning)):
top = symtable.symtable(TEST_CODE, "?", "exec")
# These correspond to scopes in TEST_CODE
Mine = find_block(top, "Mine")