diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 5186a57dd31..df3dce67561 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -370,12 +370,8 @@ def make_bad_fd(): unlink(TESTFN) def check_syntax_error(testcase, statement): - try: - compile(statement, '', 'exec') - except SyntaxError: - pass - else: - testcase.fail('Missing SyntaxError: "%s"' % statement) + testcase.assertRaises(SyntaxError, compile, statement, + '', 'exec') def open_urlresource(url): import urllib, urlparse