diff options
author | Georg Brandl <georg@python.org> | 2009-06-04 18:59:58 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-06-04 18:59:58 (GMT) |
commit | 4da2fa5517e2bc844457804b48175e6838cae762 (patch) | |
tree | 7fe6a04e9c75119710d823d9dc176d6205e13836 /Lib/test/test_traceback.py | |
parent | e7dbebbadf40b4b2524b015495eaa2aa0c2f82df (diff) | |
download | cpython-4da2fa5517e2bc844457804b48175e6838cae762.zip cpython-4da2fa5517e2bc844457804b48175e6838cae762.tar.gz cpython-4da2fa5517e2bc844457804b48175e6838cae762.tar.bz2 |
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 5cd08ee..1140a94 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -24,6 +24,9 @@ class TracebackCases(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 @@ -39,6 +42,12 @@ class TracebackCases(unittest.TestCase): self.assert_("^" in err[2]) # third line has caret self.assert_(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?) |