From 2bc8f0e6867f59e5e8444b2bde99bb0fa3dbefc8 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 26 Jul 2017 20:54:40 -0400 Subject: bpo-31003: IDLE - Add more tests for General tab (#2859) * In configdialog: Document causal pathways in create_page_general. Move related functions to follow this. Simplify some attribute names. * In test_configdialog: Add tests for load and helplist functions. Coverage for the general tab is now complete, and 63% overall. --- Lib/idlelib/idle_test/mock_idle.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Lib/idlelib/idle_test/mock_idle.py') diff --git a/Lib/idlelib/idle_test/mock_idle.py b/Lib/idlelib/idle_test/mock_idle.py index 8f3147b1c5c..f279a52fd51 100644 --- a/Lib/idlelib/idle_test/mock_idle.py +++ b/Lib/idlelib/idle_test/mock_idle.py @@ -13,14 +13,16 @@ class Func: self.args - capture positional arguments. self.kwds - capture keyword arguments. self.result - return or raise value set in __init__. + self.return_self - return self instead, to mock query class return. Most common use will probably be to mock instance methods. Given class instance, can set and delete as instance attribute. Mock_tk.Var and Mbox_func are special variants of this. ''' - def __init__(self, result=None): + def __init__(self, result=None, return_self=False): self.called = 0 self.result = result + self.return_self = return_self self.args = None self.kwds = None def __call__(self, *args, **kwds): @@ -29,6 +31,8 @@ class Func: self.kwds = kwds if isinstance(self.result, BaseException): raise self.result + elif self.return_self: + return self else: return self.result -- cgit v1.2.3