diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-24 03:24:56 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-24 03:24:56 (GMT) |
commit | 2bf74fd0ac6e30f1e8234954d30920016f33736e (patch) | |
tree | 48e67ef8aae287af8ded457a5dc1bd69c5a750a1 | |
parent | 037154865e9f1f9dd64a1120a76ebc899cc86f95 (diff) | |
download | cpython-2bf74fd0ac6e30f1e8234954d30920016f33736e.zip cpython-2bf74fd0ac6e30f1e8234954d30920016f33736e.tar.gz cpython-2bf74fd0ac6e30f1e8234954d30920016f33736e.tar.bz2 |
this is better written using assertRaises
-rw-r--r-- | Lib/test/test_support.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 5186a57..df3dce6 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, '<test string>', 'exec') - except SyntaxError: - pass - else: - testcase.fail('Missing SyntaxError: "%s"' % statement) + testcase.assertRaises(SyntaxError, compile, statement, + '<test string>', 'exec') def open_urlresource(url): import urllib, urlparse |