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

Function test_ExceptionChainRepr

testing/code/test_code.py:213–227  ·  view source on GitHub ↗

Test ExceptionChainRepr, especially with regard to being hashable.

()

Source from the content-addressed store, hash-verified

211
212
213def test_ExceptionChainRepr():
214 """Test ExceptionChainRepr, especially with regard to being hashable."""
215 try:
216 raise ValueError()
217 except ValueError:
218 excinfo1 = ExceptionInfo.from_current()
219 excinfo2 = ExceptionInfo.from_current()
220
221 repr1 = excinfo1.getrepr()
222 repr2 = excinfo2.getrepr()
223 assert repr1 != repr2
224
225 assert isinstance(repr1, ExceptionChainRepr)
226 assert hash(repr1) != hash(repr2)
227 assert repr1 is not excinfo1.getrepr()

Callers

nothing calls this directly

Calls 2

from_currentMethod · 0.80
getreprMethod · 0.80

Tested by

no test coverage detected