[Python-ideas] doctest

Steven D'Aprano steve at pearwood.info
Fri Mar 2 06:36:57 CET 2012


Steven D'Aprano wrote:

> This approach doesn't try to be too clever: it's a dumb, understandable 
> test which should fit in nicely with the other tests in 
> doctest.OutputChecker.check_output, perhaps something like this:
> 
> 
> if optionflags & IGNORE_WORD_ORDER:
>     if sorted(got.split()) == sorted(want.split()):
>         return True

Ah, buggarit, too simple. I neglected to take into account the delimiters.

Getting this right is harder than I thought, particularly with nested sets/dicts.

Still, I reckon a directive is the right approach.


-- 
Steven




More information about the Python-ideas mailing list