_pytest._io.saferepr module¶
-
_format_repr_exception
(exc: BaseException, obj: Any) → str[source]¶
-
class
SafeRepr
(maxsize: int)[source]¶ Bases:
reprlib.Repr
subclass of repr.Repr that limits the resulting size of repr() and includes information on exceptions raised during the call.
-
safeformat
(obj: Any) → str[source]¶ return a pretty printed string for the given object. Failing __repr__ functions of user instances will be represented with a short exception info.
-
saferepr
(obj: Any, maxsize: int = 240) → str[source]¶ return a size-limited safe repr-string for the given object. Failing __repr__ functions of user instances will be represented with a short exception info and ‘saferepr’ generally takes care to never raise exceptions itself. This function is a wrapper around the Repr/reprlib functionality of the standard 2.6 lib.
-
class
AlwaysDispatchingPrettyPrinter
(indent=1, width=80, depth=None, stream=None, *, compact=False, sort_dicts=True)[source]¶ Bases:
pprint.PrettyPrinter
PrettyPrinter that always dispatches (regardless of width).