mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
this is better written using assertRaises
This commit is contained in:
parent
037154865e
commit
2bf74fd0ac
1 changed files with 2 additions and 6 deletions
|
@ -370,12 +370,8 @@ def make_bad_fd():
|
||||||
unlink(TESTFN)
|
unlink(TESTFN)
|
||||||
|
|
||||||
def check_syntax_error(testcase, statement):
|
def check_syntax_error(testcase, statement):
|
||||||
try:
|
testcase.assertRaises(SyntaxError, compile, statement,
|
||||||
compile(statement, '<test string>', 'exec')
|
'<test string>', 'exec')
|
||||||
except SyntaxError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
testcase.fail('Missing SyntaxError: "%s"' % statement)
|
|
||||||
|
|
||||||
def open_urlresource(url):
|
def open_urlresource(url):
|
||||||
import urllib, urlparse
|
import urllib, urlparse
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue