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

Method checkraises

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

Source from the content-addressed store, hash-verified

76
77 # check that obj.method(*args) raises exc
78 def checkraises(self, exc, obj, methodname, *args, expected_msg=None):
79 obj = self.fixtype(obj)
80 args = self.fixtype(args)
81 with self.assertRaises(exc) as cm:
82 getattr(obj, methodname)(*args)
83 self.assertNotEqual(str(cm.exception), '')
84 if expected_msg is not None:
85 self.assertEqual(str(cm.exception), expected_msg)
86
87 # call obj.method(*args) without any checks
88 def checkcall(self, obj, methodname, *args):

Callers 15

test_countMethod · 0.95
test_findMethod · 0.95
test_rfindMethod · 0.95
test_indexMethod · 0.95
test_rindexMethod · 0.95
test_lowerMethod · 0.95
test_upperMethod · 0.95
test_expandtabsMethod · 0.95
test_splitMethod · 0.95
test_rsplitMethod · 0.95
test_replaceMethod · 0.95
test_replace_overflowMethod · 0.95

Calls 5

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

Tested by

no test coverage detected