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

Method checkraises

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

Source from the content-addressed store, hash-verified

27 )
28
29 def checkraises(self, exc, obj, methodname, *args, expected_msg=None):
30 obj = self.fixtype(obj)
31 # we don't fix the arguments, because UserString can't cope with it
32 with self.assertRaises(exc) as cm:
33 getattr(obj, methodname)(*args)
34 self.assertNotEqual(str(cm.exception), '')
35 if expected_msg is not None:
36 self.assertEqual(str(cm.exception), expected_msg)
37
38 def checkcall(self, object, methodname, *args):
39 object = self.fixtype(object)

Callers 2

Calls 6

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

Tested by

no test coverage detected