MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_unhashable

Method test_unhashable

Lib/test/test_traceback.py:3879–3896  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3877 self.assertEqual(list(excs[0].format()), list(excs[1].format()))
3878
3879 def test_unhashable(self):
3880 class UnhashableException(Exception):
3881 def __eq__(self, other):
3882 return True
3883
3884 ex1 = UnhashableException('ex1')
3885 ex2 = UnhashableException('ex2')
3886 try:
3887 raise ex2 from ex1
3888 except UnhashableException:
3889 try:
3890 raise ex1
3891 except UnhashableException as e:
3892 exc_obj = e
3893 exc = traceback.TracebackException.from_exception(exc_obj)
3894 formatted = list(exc.format())
3895 self.assertIn('UnhashableException: ex2\n', formatted[2])
3896 self.assertIn('UnhashableException: ex1\n', formatted[6])
3897
3898 def test_limit(self):
3899 def recurse(n):

Callers

nothing calls this directly

Calls 5

listClass · 0.85
from_exceptionMethod · 0.80
assertInMethod · 0.80
UnhashableExceptionClass · 0.70
formatMethod · 0.45

Tested by

no test coverage detected