diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2017-07-27 00:54:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-27 00:54:40 (GMT) |
commit | 2bc8f0e6867f59e5e8444b2bde99bb0fa3dbefc8 (patch) | |
tree | 78946072316d95a5d036cdff438a298b8bd4f2cb /Lib/idlelib/idle_test/mock_idle.py | |
parent | 45bf723c6c591ec56a18dad8150ae89797450d8b (diff) | |
download | cpython-2bc8f0e6867f59e5e8444b2bde99bb0fa3dbefc8.zip cpython-2bc8f0e6867f59e5e8444b2bde99bb0fa3dbefc8.tar.gz cpython-2bc8f0e6867f59e5e8444b2bde99bb0fa3dbefc8.tar.bz2 |
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.
Diffstat (limited to 'Lib/idlelib/idle_test/mock_idle.py')
-rw-r--r-- | Lib/idlelib/idle_test/mock_idle.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/idlelib/idle_test/mock_idle.py b/Lib/idlelib/idle_test/mock_idle.py index 8f3147b..f279a52 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 |