~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/test/test_traceback.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    def syntax_error_with_caret(self):
35
35
        compile("def fact(x):\n\treturn x!\n", "?", "exec")
36
36
 
 
37
    def syntax_error_with_caret_2(self):
 
38
        compile("1 +\n", "?", "exec")
 
39
 
37
40
    def syntax_error_without_caret(self):
38
41
        # XXX why doesn't compile raise the same traceback?
39
42
        import test.badsyntax_nocaret
49
52
        self.assert_("^" in err[2]) # third line has caret
50
53
        self.assert_(err[1].find("!") == err[2].find("^")) # in the right place
51
54
 
 
55
        err = self.get_exception_format(self.syntax_error_with_caret_2,
 
56
                                        SyntaxError)
 
57
        self.assert_("^" in err[2]) # third line has caret
 
58
        self.assert_(err[2].count('\n') == 1) # and no additional newline
 
59
        self.assert_(err[1].find("+") == err[2].find("^")) # in the right place
 
60
 
52
61
    def test_nocaret(self):
53
62
        if is_jython:
54
63
            # jython adds a caret in this case (why shouldn't it?)