[Python-checkins] r73233 - in python/branches/py3k: Lib/test/test_traceback.py

georg.brandl python-checkins at python.org
Thu Jun 4 21:41:00 CEST 2009


Author: georg.brandl
Date: Thu Jun 4 21:41:00 2009
New Revision: 73233
Log:
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.
........
Modified:
 python/branches/py3k/ (props changed)
 python/branches/py3k/Lib/test/test_traceback.py
Modified: python/branches/py3k/Lib/test/test_traceback.py
==============================================================================
--- python/branches/py3k/Lib/test/test_traceback.py	(original)
+++ python/branches/py3k/Lib/test/test_traceback.py	Thu Jun 4 21:41:00 2009
@@ -26,6 +26,9 @@
 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 @@
 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?)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /