31 May
2008
31 May
'08
8:18 a.m.
Martijn Faassen wrote:
I wonder whether doctest can be extended/adapted so it can normalize strings.
You can use lib2to3 to convert doctests before running them. That works well in most cases, but isn't trivial to set up either and you may still have to change your tests to enable an automated conversion. A straight 2to3 option in the doctest module would be nice anyway. What I did for lxml was changing most doctests to the more explicit Py3 syntax (or actually a bit of a mix of both worlds) and use a couple of regular expressions to fix them up before passing them to doctest. Not ideal, but it works well enough for now. Stefan