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

Method __repr__

src/_pytest/raises.py:666–677  ·  src/_pytest/raises.py::RaisesExc.__repr__
(self)

Source from the content-addressed store, hash-verified

664 return self._check_check(exception)
665
666 def __repr__(self) -> str:
667 parameters = []
668 if self.expected_exceptions:
669 parameters.append(_exception_type_name(self.expected_exceptions))
670 if self.match is not None:
671 class="cm"># If no flags were specified, discard the redundant re.compile() here.
672 parameters.append(
673 fclass="st">"match={_match_pattern(self.match)!r}",
674 )
675 if self.check is not None:
676 parameters.append(fclass="st">"check={repr_callable(self.check)}")
677 return fclass="st">"RaisesExc({&class="cm">#x27;, '.join(parameters)})"
678
679 def _check_type(self, exception: BaseException) -> TypeGuard[BaseExcT_co_default]:
680 self._fail_reason = _check_raw_type(self.expected_exceptions, exception)

Callers

nothing calls this directly

Calls 5

_exception_type_nameFunction · 0.85
_match_patternFunction · 0.85
repr_callableFunction · 0.85
appendMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected