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
Idle: test SearchDialogBase.py #62792
Comments
This is a basic set of tests for SearchDialogBase. It mainly consists of gui code, so I was not completely sure of how/what to test. Before venturing any further, I thought I would make sure I'm heading in the right direction. |
As suggested by Ezio, I factored out the button tests to a common method. |
New changeset 0d2b87ec9f2b by Terry Jan Reedy in branch '2.7': New changeset e09dfdbeb9a2 by Terry Jan Reedy in branch '3.3': New changeset 358a2b2fbad4 by Terry Jan Reedy in branch '3.3': New changeset 1f2b78941c4a by Terry Jan Reedy in branch '2.7': |
I added the docstrings that I wish had already been present. |
A subtle point about coverage. The target module must be imported. With this change, the four uncovered lines were "btn.select()" after The attached file has a few other cosmetic changes, like 'self.searchengine' to 'self.engine'. I would like to remove the duplicate testing in test_create_widgets. All we care for that test is that create_widgets calls the other four create methods. This could be done either by mocking the other methods (unittest.mock or custom replacement) or by looking to see that there is one entry, option button, other button, and command button. Were you planning to do the check-label todos? |
For next edit -- docstring for class SearchDialogBase:
This is wrong -- these are Checkbuttons
dialog-specific Radiobuttons |
Added tests for labels, a mock function for widget creation, a back option for radiobuttontests, and the docstring fixes that Terry mentioned. |
New changeset 752439a6bdd9 by Terry Jan Reedy in branch '2.7': New changeset ed60a73e1c82 by Terry Jan Reedy in branch '3.4': |
I am getting the ttk Themechanges warning. The test needs to use an search engine altered as with test_searchengine. I will work on that next. |
The warning was due to absence of def self.root. Attached is close to what will commit. |
New changeset 2b7a4cbed2a0 by Terry Jan Reedy in branch '2.7': New changeset a0e8f2d882a3 by Terry Jan Reedy in branch '3.4': |
New changeset a7f943a13f7f by Terry Jan Reedy in branch '2.7': New changeset 86c26ff25207 by Terry Jan Reedy in branch '3.4': |
Hi, ====================================================================== Traceback (most recent call last):
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/idlelib/idle_test/test_searchdialogbase.py", line 83, in test_make_entry
equal(egi['row'], 0)
AssertionError: '0' != 0 Ran 128 tests in 0.779s FAILED (failures=1) Attach patch fixes it in a straight forward way. |
Serhiy: we are having a problem with tkinter sometimes reporting boolean vars as '0' and '1' versus 0 and 1. As I remember, you pushed a patch about this in the last year, probably before 3.4 came out, but after last August. Am I correct? If so, do you remember the issue? Saimadhav: changing expected values *back* to '0'/'1', as in Phil's original patch, will make the test fail on all the systems (including all stable buildbots) that *do* return 0/1. After Serhiy's fix, I had to switch to 0/1 for 3.4/5 to make the tests pass again, after the change made them fail. Notice that the 2.7 version, pushed on 6/30 also, still has '0', '1'. The interesting question is why the Debian 3.4 system is different? Why is it acting like 2.7? Serhiy, do you have any idea? I am also puzzled why the corresponding text_tcl or _tk did not fail, as I presume there is a text for the change. |
(I am removing the patch as this issue has a background that I was not aware of.) |
What micro tk version? as in >>> t = tk.Tk()
>>> t.tk.call('info', 'patchlevel')
'8.5.15' |
I pushed a patch which fixed Text.debug(). This is not related to this issue. grid_info() values are depend on Tcl/Tk version. When < 8.6 strings are always returned (except the 'in' key which is special case), when >= 8.6 values can be integers or even tuples. I introduced the AbstractWidgetTest._str() method to convert expected value in widget tests. In these tests you can just write equal(int(egi['row']), 0). |
Ah, Debian must not be using 8.6. Thanks for both the clarification and how to fix. |
New changeset 30a75f75a4d4 by Terry Jan Reedy in branch '2.7': New changeset 91546aa91cee by Terry Jan Reedy in branch '3.4': |
A bug introduced by 91491:a0e8f2d882a3. Opening Find-in-files gives the following error Exception in Tkinter callback
Traceback (most recent call last):
File "/home/saimadhav/dev/34-cpython/Lib/tkinter/__init__.py", line 1487, in __call__
.
.
<SNIPPED>
.
.
self.tk = master.tk
AttributeError: 'tuple' object has no attribute 'tk' |
New changeset b6c5719e0f4e by Terry Jan Reedy in branch '2.7': New changeset 407110796b16 by Terry Jan Reedy in branch '3.4': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: