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:
Georg Brandl 2006-10-28 13:10:17 +00:00
parent 3a3d8ea497
commit c6fdec6d7e
8 changed files with 1203 additions and 1228 deletions

View file

@ -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