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

Class Mbox_func

Lib/idlelib/idle_test/mock_tk.py:41–56  ·  view source on GitHub ↗

Generic mock for messagebox functions, which all have the same signature. Instead of displaying a message box, the mock's call method saves the arguments as instance attributes, which test functions can then examine. The test can set the result returned to ask function

Source from the content-addressed store, hash-verified

39
40
41class Mbox_func:
42 """Generic mock for messagebox functions, which all have the same signature.
43
44 Instead of displaying a message box, the mock's call method saves the
45 arguments as instance attributes, which test functions can then examine.
46 The test can set the result returned to ask function
47 """
48 def __init__(self, result=None):
49 self.result = result # Return None for all show funcs
50 def __call__(self, title, message, *args, **kwds):
51 # Save all args for possible examination by tester
52 self.title = title
53 self.message = message
54 self.args = args
55 self.kwds = kwds
56 return self.result # Set by tester for ask functions
57
58
59class Mbox:

Callers 6

ValidatorClass · 0.90
BasicClass · 0.90
test_goto_file_lineMethod · 0.90
setUpClassMethod · 0.90
setUpClassMethod · 0.90
MboxClass · 0.85

Calls

no outgoing calls

Tested by 3

test_goto_file_lineMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…