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

Function test_repr_traceback_with_unicode

testing/code/test_excinfo.py:1676–1687  ·  view source on GitHub ↗
(style, encoding)

Source from the content-addressed store, hash-verified

1674@pytest.mark.parametrize("style", ["short", "long"])
1675@pytest.mark.parametrize("encoding", [None, "utf8", "utf16"])
1676def test_repr_traceback_with_unicode(style, encoding):
1677 if encoding is None:
1678 msg: str | bytes = "☹"
1679 else:
1680 msg = "☹".encode(encoding)
1681 try:
1682 raise RuntimeError(msg)
1683 except RuntimeError:
1684 e_info = ExceptionInfo.from_current()
1685 formatter = ExceptionInfoFormatter(style=style)
1686 repr_traceback = formatter.repr_traceback(e_info)
1687 assert repr_traceback is not None
1688
1689
1690def test_cwd_deleted(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

repr_tracebackMethod · 0.95
from_currentMethod · 0.80

Tested by

no test coverage detected