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

Function test_ExceptionChainRepr

testing/code/test_code.py:198–212  ·  view source on GitHub ↗

Test ExceptionChainRepr, especially with regard to being hashable.

()

Source from the content-addressed store, hash-verified

196
197
198def test_ExceptionChainRepr():
199 """Test ExceptionChainRepr, especially with regard to being hashable."""
200 try:
201 raise ValueError()
202 except ValueError:
203 excinfo1 = ExceptionInfo.from_current()
204 excinfo2 = ExceptionInfo.from_current()
205
206 repr1 = excinfo1.getrepr()
207 repr2 = excinfo2.getrepr()
208 assert repr1 != repr2
209
210 assert isinstance(repr1, ExceptionChainRepr)
211 assert hash(repr1) != hash(repr2)
212 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