Kaydet (Commit) 751899a5 authored tarafından Georg Brandl's avatar Georg Brandl

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.
........
üst 40925d28
...@@ -26,6 +26,9 @@ class SyntaxTracebackCases(unittest.TestCase): ...@@ -26,6 +26,9 @@ class SyntaxTracebackCases(unittest.TestCase):
def syntax_error_with_caret(self): def syntax_error_with_caret(self):
compile("def fact(x):\n\treturn x!\n", "?", "exec") 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): def syntax_error_without_caret(self):
# XXX why doesn't compile raise the same traceback? # XXX why doesn't compile raise the same traceback?
import test.badsyntax_nocaret import test.badsyntax_nocaret
...@@ -41,6 +44,12 @@ class SyntaxTracebackCases(unittest.TestCase): ...@@ -41,6 +44,12 @@ class SyntaxTracebackCases(unittest.TestCase):
self.assert_("^" in err[2]) # third line has caret self.assert_("^" in err[2]) # third line has caret
self.assertEqual(err[1].find("!"), err[2].find("^")) # in the right place 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): def test_nocaret(self):
if is_jython: if is_jython:
# jython adds a caret in this case (why shouldn't it?) # jython adds a caret in this case (why shouldn't it?)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment