diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-02-19 15:35:26 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-02-19 15:35:26 (GMT) |
commit | 4779399e9f4ff6fe7734fa9931aa6df82a98da24 (patch) | |
tree | bb5da06b7e75258f69c244e73ad9e5a91fdc5fe9 /Lib/test/test_grammar.py | |
parent | c348cd751846ddc8cec61c47928867e30d94549c (diff) | |
download | cpython-4779399e9f4ff6fe7734fa9931aa6df82a98da24.zip cpython-4779399e9f4ff6fe7734fa9931aa6df82a98da24.tar.gz cpython-4779399e9f4ff6fe7734fa9931aa6df82a98da24.tar.bz2 |
Add test for syntax error on "x = 1 + 1".
Move check_syntax() function into test_support.
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r-- | Lib/test/test_grammar.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 53ae070..781f373 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -3,14 +3,6 @@ from test_support import * -def check_syntax(statement): - try: - compile(statement, '<string>', 'exec') - except SyntaxError: - print 'SyntaxError expected for "%s"' % statement - else: - print 'Missing SyntaxError: "%s"' % statement - print '1. Parser' print '1.1 Tokens' @@ -280,6 +272,9 @@ x, y, z = 1, 2, 3 abc = a, b, c = x, y, z = xyz = 1, 2, (3, 4) # NB these variables are deleted below +check_syntax("x + 1 = 1") +check_syntax("a + 1 = b + 2") + print 'print_stmt' # 'print' (test ',')* [test] print 1, 2, 3 print 1, 2, 3, |