MCPcopy Index your code
hub / github.com/python/cpython / test_bad_indentation

Method test_bad_indentation

Lib/test/test_traceback.py:226–238  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

224 unlink(TESTFN)
225
226 def test_bad_indentation(self):
227 err = self.get_exception_format(self.syntax_error_bad_indentation,
228 IndentationError)
229 self.assertEqual(len(err), 4)
230 self.assertEqual(err[1].strip(), "print(2)")
231 self.assertIn("^", err[2])
232 self.assertEqual(err[1].find(")") + 1, err[2].find("^"))
233
234 # No caret for "unexpected indent"
235 err = self.get_exception_format(self.syntax_error_bad_indentation2,
236 IndentationError)
237 self.assertEqual(len(err), 3)
238 self.assertEqual(err[1].strip(), "print(2)")
239
240 def test_base_exception(self):
241 # Test that exceptions derived from BaseException are formatted right

Callers

nothing calls this directly

Calls 5

get_exception_formatMethod · 0.95
assertInMethod · 0.80
assertEqualMethod · 0.45
stripMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected