This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients JayKrish, Saimadhav.Heblikar, Todd.Rovito, jesstess, philwebster, terry.reedy
Date 2014-06-03.05:47:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1401774477.41.0.113613950689.issue18292@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-06-03 05:47:58terry.reedysetrecipients: + terry.reedy, jesstess, Todd.Rovito, JayKrish, philwebster, Saimadhav.Heblikar
2014-06-03 05:47:57terry.reedysetmessageid: <1401774477.41.0.113613950689.issue18292@psf.upfronthosting.co.za>
2014-06-03 05:47:57terry.reedylinkissue18292 messages
2014-06-03 05:47:55terry.reedycreate