From: Benjamin Peterson Date: Tue, 24 Mar 2009 03:24:56 +0000 (+0000) Subject: this is better written using assertRaises X-Git-Tag: v2.7a1~1802 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bf74fd0ac6e30f1e8234954d30920016f33736e;p=python this is better written using assertRaises --- diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 5186a57dd3..df3dce6756 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