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

Method _assert_run_failed

Lib/test/test__interpreters.py:900–919  ·  view source on GitHub ↗
(self, exctype, msg, script)

Source from the content-addressed store, hash-verified

898 os.close(w)
899
900 def _assert_run_failed(self, exctype, msg, script):
901 if isinstance(exctype, str):
902 exctype_name = exctype
903 exctype = None
904 else:
905 exctype_name = exctype.__name__
906
907 # Run the script.
908 excinfo = self.run_script(script, fails=True)
909
910 # Check the wrapper exception.
911 self.assertEqual(excinfo.type.__name__, exctype_name)
912 if msg is None:
913 self.assertEqual(excinfo.formatted.split(':')[0],
914 exctype_name)
915 else:
916 self.assertEqual(excinfo.formatted,
917 '{}: {}'.format(exctype_name, msg))
918
919 return excinfo
920
921 def assert_run_failed(self, exctype, script):
922 self._assert_run_failed(exctype, None, script)

Callers 2

assert_run_failedMethod · 0.95
assert_run_failed_msgMethod · 0.95

Calls 4

run_scriptMethod · 0.95
assertEqualMethod · 0.45
splitMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected