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

Method checkraises

Lib/test/test_userstring.py:38–45  ·  view source on GitHub ↗
(self, exc, obj, methodname, *args, expected_msg=None)

Source from the content-addressed store, hash-verified

36 )
37
38 def checkraises(self, exc, obj, methodname, *args, expected_msg=None):
39 obj = self.fixtype(obj)
40 # we don't fix the arguments, because UserString can't cope with it
41 with self.assertRaises(exc) as cm:
42 getattr(obj, methodname)(*args)
43 self.assertNotEqual(str(cm.exception), '')
44 if expected_msg is not None:
45 self.assertEqual(str(cm.exception), expected_msg)
46
47 def checkcall(self, object, methodname, *args):
48 object = self.fixtype(object)

Callers 2

Calls 5

strFunction · 0.85
assertNotEqualMethod · 0.80
fixtypeMethod · 0.45
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected