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

Method checkInvalidParam

Lib/test/test_tkinter/widget_tests.py:68–78  ·  view source on GitHub ↗
(self, widget, name, value, errmsg=None)

Source from the content-addressed store, hash-verified

66 self.assertEqual2(t[4], expected, eq=eq)
67
68 def checkInvalidParam(self, widget, name, value, errmsg=None):
69 orig = widget[name]
70 if errmsg is not None:
71 errmsg = errmsg.format(re.escape(str(value)))
72 errmsg = fr'\A{errmsg}\z'
73 with self.assertRaisesRegex(tkinter.TclError, errmsg or ''):
74 widget[name] = value
75 self.assertEqual(widget[name], orig)
76 with self.assertRaisesRegex(tkinter.TclError, errmsg or ''):
77 widget.configure({name: value})
78 self.assertEqual(widget[name], orig)
79
80 def checkParams(self, widget, name, *values, **kwargs):
81 for value in values:

Callers 15

checkIntegerParamMethod · 0.95
checkFloatParamMethod · 0.95
checkBooleanParamMethod · 0.95
checkColorParamMethod · 0.95
checkCursorParamMethod · 0.95
checkEnumParamMethod · 0.95
checkPixelsParamMethod · 0.95
checkReliefParamMethod · 0.95
checkImageParamMethod · 0.95
test_configure_classMethod · 0.80

Calls 6

strFunction · 0.85
escapeMethod · 0.80
assertRaisesRegexMethod · 0.80
formatMethod · 0.45
assertEqualMethod · 0.45
configureMethod · 0.45

Tested by

no test coverage detected