On 9 Feb, 15:20, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 09 Feb 2008 05:44:27 -0800, bearophileHUGS wrote: > > def issubseq(sub, items): > > """issubseq(sub, items): return true if the sequence 'sub' is a > > contiguous subsequence of the 'items' sequence. > > [snip] > > A stylistic note for you... > > I believe that it is considered an abuse of doctest to write a function > with 28 lines of code and 19 tests (about two tests per three LOC). Your > second function (adapted from mine) with 18 tests and only 14 LOC is even > more abusive. > > (At least, *I* consider it an abuse of doctest.) >
Hi Steven, I disagree with you there. A large problem, along with poor documentation, is no testing. If doctest makes it much easier to test, use doctest. If you prefer other methods then use them, but applaud Bearophile for not only testing, but showing his tests. If it doesn't interest you then skip it, but it at least has shown that Bearophile thought to test his code. The blatent and interesting bugs are usually the first thought of, and found. It usually takes thorough analysis of the program under testing before it is wise to remove a test and trivial, or uninteresting are not usually reasons to remove a test wothout qualification. Bearophile might want to use another file for his doctests, but that would hardly help when posting to usenet. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list