-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
bpo-30981: IDLE: Add more configdialog font page tests. #2805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Cheryl, thank you for fixing the main flaw in what I did (binding Func() to the wrong reference). I will explain the remaining touchups after I test them. |
Commit message, 2nd line: Cheryl, after I pushed c4cf031, github will no longer let me push changes, which means no web edit either. It is like github unchecked the box that gives core devs permission to change a pr. |
There were two problems with your patch. First, deleting local variables at the end of the function is either useless or redundant; they are deleted anyway when the function exits. Doing so will not reverse mutations of persistent objects, like change the command of bold_toggle. More important, the purpose of testing bold_toggle test is to confirm that clicking the button changes the sample displays (as well as the 'variable'). The is the 'user benefit'. Your test only confirms that invoke() (and presumably a click) really calls the command, as documented. Failure would be a tkinter or tk bug, not an IDLE bug. A separate test was needed to test that the command had originally been set_samples before being mocked. When a 'command' option is set to a Python function, it is wrapped in a tk tcl function and option 'command' is set to the Python string name of the tcl function. Currently, |
Thank you again for explaining that. I"m trying so hard to understand the reasons for doing certain unit tests in certain ways and I still don't have a good grasp of things, like when to delete variables or even what to test. :-( I had mocked out font_bold because of the side effect of the trace causing the font_bold changes to be added to This is what I get in test_font_set if it's not run first: ======================================================================
|
Testing should test that code fulfills it purpose. This is why I added the docstring paragraph about the purpose and strategy of the font page. In this case, there are two causal pathways (cause effect chains) leading from each user action to two results. The result is a directed acyclic graph of actions: user action, event generation, Var.set() call, method call, tk wrapper call, or widget['option'] setting). It constitutes the tactics of the page. Each test function tests a portion of the graph. The should collectively test the entire graph. Given that we cannot put a png into the docstring ;-), I will try to rework the lists of Var and methods into a description of the graph. I noticed the temporary failure of test_font_set and should have investigated, but let myself be distracted by github first adding past commits to my PRs and then messing up this one. Thanks for the reminder. Test functions passing should preferably not depend on their arbitrary names and consequent order. I had though of calling the combined test 'test_bold_toggle_and_set_samples'. Doing so reproduces the failure because bold is toggled 3 times. The issue is that size and bold need to be initialized in test_font_set because they are not initialized in changes.clear (and should and cannot be). This is related to the fact that 1 font var change write 3 changes, because maybe at one time all 3 were written to user config-main.cfg, but I don't think that is true now, so I am not sure that the triple add_option is really needed. If changes were initialized with default font options, test_font_set would be okay. But that might cause other problems. Another issue. |
bpo-30993 is followup for this |
https://bugs.python.org/issue30981
I can edit your comment.