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

Method getrepr

src/_pytest/_code/code.py:701–774  ·  src/_pytest/_code/code.py::ExceptionInfo.getrepr

Return str()able representation of this exception info. The formatting parameters are ineffective if ``style="native"``, since in this case the native formatting is used. :param bool showlocals: Show locals per traceback entry. :param str style:

(
        self,
        showlocals: bool = False,
        style: TracebackStyle = "long",
        abspath: bool = False,
        tbfilter: bool | Callable[[ExceptionInfo[BaseException]], Traceback] = True,
        funcargs: bool = False,
        truncate_locals: bool = True,
        truncate_args: bool = True,
        chain: bool = True,
    )

Source from the content-addressed store, hash-verified

699 return None
700
701 def getrepr(
702 self,
703 showlocals: bool = False,
704 style: TracebackStyle = class="st">"long",
705 abspath: bool = False,
706 tbfilter: bool | Callable[[ExceptionInfo[BaseException]], Traceback] = True,
707 funcargs: bool = False,
708 truncate_locals: bool = True,
709 truncate_args: bool = True,
710 chain: bool = True,
711 ) -> ReprExceptionInfo | ExceptionChainRepr:
712 class="st">"""Return str()able representation of this exception info.
713
714 The formatting parameters are ineffective if ``style=class="st">"native"``,
715 since in this case the native formatting is used.
716
717 :param bool showlocals:
718 Show locals per traceback entry.
719
720 :param str style:
721 long|short|line|no|native|value traceback style.
722
723 :param bool abspath:
724 If paths should be changed to absolute or left unchanged.
725
726 :param tbfilter:
727 A filter for traceback entries.
728
729 * If false, don&class="cm">#x27;t hide any entries.
730 * If true, hide internal entries and entries that contain a local
731 variable ``__tracebackhide__ = True``.
732 * If a callable, delegates the filtering to the callable.
733
734 :param bool funcargs:
735 Show function arguments per traceback entry.
736
737 :param bool truncate_locals:
738 Whether to show a size-limited `repr()` of locals, or a full
739 pretty-printing.
740
741 :param bool truncate_args:
742 Whether to show a size-limited truncated `repr()` of function
743 arguments, or a full pretty-printing.
744
745 :param bool chain:
746 If chained exceptions should be shown.
747
748 .. versionchanged:: 3.9
749
750 Added the ``chain`` parameter.
751 class="st">"""
752 if style == class="st">"native":
753 return ReprExceptionInfo(
754 reprtraceback=ReprTracebackNative(
755 format_exception(
756 self.type,
757 self.value,
758 self.traceback[0]._rawentry if self.traceback else None,

Calls 5

_getreprcrashMethod · 0.95
repr_excinfoMethod · 0.95
ReprExceptionInfoClass · 0.85
ReprTracebackNativeClass · 0.85