mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Convert test_global, test_scope and test_grammar to unittest.
I tried to enclose all tests which must be run at the toplevel (instead of inside a method) in exec statements.
This commit is contained in:
parent
3a3d8ea497
commit
c6fdec6d7e
8 changed files with 1203 additions and 1228 deletions
|
@ -245,13 +245,13 @@ def sortdict(dict):
|
|||
withcommas = ", ".join(reprpairs)
|
||||
return "{%s}" % withcommas
|
||||
|
||||
def check_syntax(statement):
|
||||
def check_syntax_error(testcase, statement):
|
||||
try:
|
||||
compile(statement, '<string>', 'exec')
|
||||
compile(statement, '<test string>', 'exec')
|
||||
except SyntaxError:
|
||||
pass
|
||||
else:
|
||||
print 'Missing SyntaxError: "%s"' % statement
|
||||
testcase.fail('Missing SyntaxError: "%s"' % statement)
|
||||
|
||||
def open_urlresource(url):
|
||||
import urllib, urlparse
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue