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

Method _failure_header

Lib/doctest.py:1321–1338  ·  view source on GitHub ↗
(self, test, example)

Source from the content-addressed store, hash-verified

1319 'Exception raised:\n' + _indent(_exception_traceback(exc_info)))
1320
1321 def _failure_header(self, test, example):
1322 red, reset = (
1323 (ANSIColors.RED, ANSIColors.RESET) if can_colorize() else ("", "")
1324 )
1325 out = [f"{red}{self.DIVIDER}{reset}"]
1326 if test.filename:
1327 if test.lineno is not None and example.lineno is not None:
1328 lineno = test.lineno + example.lineno + 1
1329 else:
1330 lineno = '?'
1331 out.append('File "%s", line %s, in %s' %
1332 (test.filename, lineno, test.name))
1333 else:
1334 out.append('Line %s, in %s' % (example.lineno+1, test.name))
1335 out.append('Failed example:')
1336 source = example.source
1337 out.append(_indent(source))
1338 return '\n'.join(out)
1339
1340 #/////////////////////////////////////////////////////////////////
1341 # DocTest Running

Callers 2

report_failureMethod · 0.95

Calls 4

can_colorizeFunction · 0.90
_indentFunction · 0.85
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected