MCPcopy
hub / github.com/pytest-dev/pytest / _format_repr_exception

Function _format_repr_exception

src/_pytest/_io/saferepr.py:17–26  ·  view source on GitHub ↗
(exc: BaseException, obj: object)

Source from the content-addressed store, hash-verified

15
16
17def _format_repr_exception(exc: BaseException, obj: object) -> str:
18 try:
19 exc_info = _try_repr_or_str(exc)
20 except (KeyboardInterrupt, SystemExit):
21 raise
22 except BaseException as inner_exc:
23 exc_info = f"unpresentable exception ({_try_repr_or_str(inner_exc)})"
24 return (
25 f"<[{exc_info} raised in repr()] {type(obj).__name__} object at 0x{id(obj):x}>"
26 )
27
28
29def _ellipsize(s: str, maxsize: int) -> str:

Callers 4

reprMethod · 0.85
repr_instanceMethod · 0.85
safeformatFunction · 0.85
saferepr_unlimitedFunction · 0.85

Calls 1

_try_repr_or_strFunction · 0.85

Tested by

no test coverage detected