Terry J. Reedy added the comment:

Great start. The initial coveraqe is 90%, only missing the 5 lines in getwords 
in the bodies of
            if dict.get(w):
                continue
,,,
        for w in wafter: 
            if dict.get(w): 
                continue 
            words.append(w) 
            dict[w] = w 

I would like to cover those because I would like to later replace the dict 
instance dict (bad name!) with a set, 'seen'. 'dict.get(w)' would become 'w in 
seen'; 'dict[w] = w' would become 'seen.add(w)'

Two comments: 1. Using 'previous' to detect the action of 'expand' is really 
clever. 

2. As is typical, you wrote both too much and too little. Too much because some 
of the subtests are redundant, testing the same code paths repeatedly. Every 
subtest should have a reason. Too little because some code paths are skipped.  
To cover with both before and after, with repeats and missed: insert 'aa ab xy 
aa ac\n ad ae xy ae ab\n', Then insert 'a' at the beginning of the second line 
((2,0) as I remember). Words should be ['ac', 'aa', 'ab', 'ad' 'ae' 'a']. 
Expand/previous should produce those in that order. Also do a test with no 
before and some after. You have already done some before and no after.

I uploaded my version. See Rietveld diff for changes. Some notes:

Leave out '-' after 'test-' in file name. Makes coverage call easier.
Todays test.support patch made a line is each file obsolete.
Must keep reference to root to destroy it properly.
I added conditionals so we can easily switch between gui and mock.
These should be added to previous tests that run both ways.
test_get_words had a bug; assertCountEqual instead of assertEqual.

getprevword only sees ascii chars when finding the word prefix. On the other 
hand, for 3.x, \w in getwords matches unicode chars for suffixes. If possible, 
getprevword should use \w to determine the prefix. Then 2.7 and 3.x should work 
on ascii and unicode respectively, with the same code. In a second stage, we 
should fix this and add tests with non-ascii chars (using \unnnn in literals).
--------

self.bell() makes no sound for me. How about you?

A different non-critical nuisance. I start Idle in the debug interpreter with 
'import idlelib.idle'. When root is destroyed, then the following is printed in 
the console interpreter after unittest is done.

can't invoke "event" command: application has been destroyed
    while executing
"event generate $w <<ThemeChanged>>"
    (procedure "ttk::ThemeChanged" line 6)
    invoked from within
"ttk::ThemeChanged"

I determined the timing by changing to 'exit=False' in unittest.main and adding 
'time.sleep(2); print('done') after the u.main() call. Do you see anything like 
this? (Deleting the class attributes does not fix this.) tkinter.ttk in not in 
sys.modules, but perhaps something in one of the other modules directly 
accesses ttk at the tcl level when shutting down.

----------
Added file: http://bugs.python.org/file35464/test-autoexp-18292.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18292>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to