(self, test, example)
| 1344 | 'Exception raised:\n' + _indent(_exception_traceback(exc_info))) |
| 1345 | |
| 1346 | def _failure_header(self, test, example): |
| 1347 | red, reset = ( |
| 1348 | (ANSIColors.RED, ANSIColors.RESET) if can_colorize() else ("", "") |
| 1349 | ) |
| 1350 | out = [f"{red}{self.DIVIDER}{reset}"] |
| 1351 | if test.filename: |
| 1352 | if test.lineno is not None and example.lineno is not None: |
| 1353 | lineno = test.lineno + example.lineno + 1 |
| 1354 | else: |
| 1355 | lineno = '?' |
| 1356 | out.append('File "%s", line %s, in %s' % |
| 1357 | (test.filename, lineno, test.name)) |
| 1358 | else: |
| 1359 | out.append('Line %s, in %s' % (example.lineno+1, test.name)) |
| 1360 | out.append('Failed example:') |
| 1361 | source = example.source |
| 1362 | out.append(_indent(source)) |
| 1363 | return '\n'.join(out) |
| 1364 | |
| 1365 | #///////////////////////////////////////////////////////////////// |
| 1366 | # DocTest Running |
no test coverage detected