summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-02-19 15:35:26 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-02-19 15:35:26 (GMT)
commit4779399e9f4ff6fe7734fa9931aa6df82a98da24 (patch)
treebb5da06b7e75258f69c244e73ad9e5a91fdc5fe9 /Lib/test/test_support.py
parentc348cd751846ddc8cec61c47928867e30d94549c (diff)
downloadcpython-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_support.py')
-rw-r--r--Lib/test/test_support.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 8861399..3a20b2e 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -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
+