mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Add test for syntax error on "x = 1 + 1".
Move check_syntax() function into test_support.
This commit is contained in:
parent
c348cd7518
commit
4779399e9f
4 changed files with 13 additions and 22 deletions
|
@ -79,3 +79,12 @@ def verify(condition, reason='test failed'):
|
|||
|
||||
if not condition:
|
||||
raise TestFailed(reason)
|
||||
|
||||
def check_syntax(statement):
|
||||
try:
|
||||
compile(statement, '<string>', 'exec')
|
||||
except SyntaxError:
|
||||
pass
|
||||
else:
|
||||
print 'Missing SyntaxError: "%s"' % statement
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue