MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_excinfo_repr_str

Function test_excinfo_repr_str

testing/code/test_excinfo.py:330–344  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

328
329
330def test_excinfo_repr_str() -> None:
331 excinfo1 = pytest.raises(ValueError, h)
332 assert repr(excinfo1) == "<ExceptionInfo ValueError() tblen=4>"
333 assert str(excinfo1) == "<ExceptionInfo ValueError() tblen=4>"
334
335 class CustomException(Exception):
336 def __repr__(self):
337 return "custom_repr"
338
339 def raises() -> None:
340 raise CustomException()
341
342 excinfo2 = pytest.raises(CustomException, raises)
343 assert repr(excinfo2) == "<ExceptionInfo custom_repr tblen=2>"
344 assert str(excinfo2) == "<ExceptionInfo custom_repr tblen=2>"
345
346
347def test_excinfo_for_later() -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected