MCPcopy Index your code
hub / github.com/python/cpython / test_builtin_exception

Method test_builtin_exception

Lib/test/test_crossinterp.py:834–853  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

832 ])
833
834 def test_builtin_exception(self):
835 msg = 'error!'
836 try:
837 raise Exception
838 except Exception as exc:
839 caught = exc
840 special = {
841 BaseExceptionGroup: (msg, [caught]),
842 ExceptionGroup: (msg, [caught]),
843 UnicodeError: (None, msg, None, None, None),
844 UnicodeEncodeError: ('utf-8', '', 1, 3, msg),
845 UnicodeDecodeError: ('utf-8', b'', 1, 3, msg),
846 UnicodeTranslateError: ('', 1, 3, msg),
847 }
848 exceptions = []
849 for cls in EXCEPTION_TYPES:
850 args = special.get(cls) or (msg,)
851 exceptions.append(cls(*args))
852
853 self.assert_roundtrip_equal(exceptions)
854
855
856class MarshalTests(_GetXIDataTests):

Callers

nothing calls this directly

Calls 4

clsClass · 0.50
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected