Commit 150a6640 authored by Jeremy Hylton's avatar Jeremy Hylton

Fix filter for SyntaxErrors

parent 3da989c6
......@@ -4,15 +4,15 @@ from test_support import check_syntax
import warnings
warnings.filterwarnings("error", category=SyntaxWarning, module=__name__)
warnings.filterwarnings("error", module="<test code>")
def compile_and_catch_warning(text):
try:
compile(text, "<test code>", "exec")
except SyntaxWarning, msg:
print "got SyntaxWarning as expected"
except SyntaxError, msg:
print "got SyntaxError as expected"
else:
print "expected SyntaxWarning"
print "expected SyntaxError"
prog_text_1 = """
def wrong1():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment