diff options
author | Georg Brandl <georg@python.org> | 2009-06-04 19:41:00 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-06-04 19:41:00 +0000 |
commit | a81114e65f5adf592293f8ec9d209e504173c5c7 (patch) | |
tree | 0bf0ad46d6ef0fa718d937d45f99ea76c9923232 /Lib/test/test_traceback.py | |
parent | 508adbd293fee9c8b887bdaa51d0e976edbe038d (diff) | |
download | cpython-a81114e65f5adf592293f8ec9d209e504173c5c7.tar.gz |
Merged revisions 73232 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73232 | georg.brandl | 2009-06-04 20:59:58 +0200 (Do, 04 Jun 2009) | 1 line
Add test for #3684.
........
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 64dc748a85..903323840e 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -26,6 +26,9 @@ class SyntaxTracebackCases(unittest.TestCase): def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") + def syntax_error_with_caret_2(self): + compile("1 +\n", "?", "exec") + def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? import test.badsyntax_nocaret @@ -41,6 +44,12 @@ class SyntaxTracebackCases(unittest.TestCase): self.assert_("^" in err[2]) # third line has caret self.assertEqual(err[1].find("!"), err[2].find("^")) # in the right place + err = self.get_exception_format(self.syntax_error_with_caret_2, + SyntaxError) + self.assert_("^" in err[2]) # third line has caret + self.assert_(err[2].count('\n') == 1) # and no additional newline + self.assert_(err[1].find("+") == err[2].find("^")) # in the right place + def test_nocaret(self): if is_jython: # jython adds a caret in this case (why shouldn't it?) |