Return the exception as a string. When 'tryshort' resolves to True, and the exception is an AssertionError, only the actual exception part of the exception representation is returned (so 'AssertionError: ' is removed from the beginning).
(self, tryshort: bool = False)
| 575 | ) |
| 576 | |
| 577 | def exconly(self, tryshort: bool = False) -> str: |
| 578 | """Return the exception as a string. |
| 579 | |
| 580 | When 'tryshort' resolves to True, and the exception is an |
| 581 | AssertionError, only the actual exception part of the exception |
| 582 | representation is returned (so 'AssertionError: ' is removed from |
| 583 | the beginning). |
| 584 | """ |
| 585 | lines = format_exception_only(self.type, self.value) |
| 586 | text = "".join(lines) |
| 587 | text = text.rstrip() |
| 588 | if tryshort: |
| 589 | if text.startswith(self._striptext): |
| 590 | text = text[len(self._striptext) :] |
| 591 | return text |
| 592 | |
| 593 | def errisinstance( |
| 594 | self, exc: Union[Type[BaseException], Tuple[Type[BaseException], ...]] |
no outgoing calls