1
"""Verify that warnings are issued for global statements following use."""
3
from test.support import run_unittest, check_syntax_error, check_warnings
8
class GlobalTests(unittest.TestCase):
11
self._warnings_manager = check_warnings()
12
self._warnings_manager.__enter__()
13
warnings.filterwarnings("error", module="<test string>")
16
self._warnings_manager.__exit__(None, None, None)
27
check_syntax_error(self, prog_text_1)
35
check_syntax_error(self, prog_text_2)
44
check_syntax_error(self, prog_text_3)
52
compile(prog_text_4, "<test string>", "exec")
56
with warnings.catch_warnings():
57
warnings.filterwarnings("error", module="<test string>")
58
run_unittest(GlobalTests)
60
if __name__ == "__main__":