summaryrefslogtreecommitdiff
path: root/Lib/test/test_traceback.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r--Lib/test/test_traceback.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 29a120f532..22c04567a7 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -24,6 +24,9 @@ class TracebackCases(unittest.TestCase):
# XXX why doesn't compile raise the same traceback?
import test.badsyntax_nocaret
+ def syntax_error_bad_indentation(self):
+ compile("def spam():\n print 1\n print 2", "?", "exec")
+
def test_caret(self):
err = self.get_exception_format(self.syntax_error_with_caret,
SyntaxError)
@@ -40,6 +43,13 @@ class TracebackCases(unittest.TestCase):
self.assert_(len(err) == 3)
self.assert_(err[1].strip() == "[x for x in x] = x")
+ def test_bad_indentation(self):
+ err = self.get_exception_format(self.syntax_error_bad_indentation,
+ IndentationError)
+ self.assert_(len(err) == 4)
+ self.assert_("^" in err[2])
+ self.assert_(err[1].strip() == "print 2")
+
def test_bug737473(self):
import sys, os, tempfile, time