MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_bad_indentation

Method test_bad_indentation

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

Source from the content-addressed store, hash-verified

201 unlink(TESTFN)
202
203 def test_bad_indentation(self):
204 err = self.get_exception_format(self.syntax_error_bad_indentation,
205 IndentationError)
206 self.assertEqual(len(err), 4)
207 self.assertEqual(err[1].strip(), "print(2)")
208 self.assertIn("^", err[2])
209 self.assertEqual(err[1].find(")") + 1, err[2].find("^"))
210
211 # No caret for "unexpected indent"
212 err = self.get_exception_format(self.syntax_error_bad_indentation2,
213 IndentationError)
214 self.assertEqual(len(err), 3)
215 self.assertEqual(err[1].strip(), "print(2)")
216
217 def test_base_exception(self):
218 # Test that exceptions derived from BaseException are formatted right

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected