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)
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue