On Fri, Jul 20, 2007 at 11:30:08AM +0200, Philipp von Weitershausen wrote: > Adam Groszer wrote: > >Great, that works ;-) > >Thought that there is some more genreic-sane way. > > There is. NORMALIZE_WHITESPACE actually only helps when whatever you're > outputting actually prints whitespace. Doing this:: > > >>> ' ' > ' ' > > won't invoke the whitespace normalizer.
I'm pretty certain you're mistaken here: >>> import doctest >>> def test1(): ... """ ... >>> ' ' # doctest: +NORMALIZE_WHITESPACE ... ' ' ... """ ... >>> doctest.testmod() (0, 1) The test passes. What wouldn't work, though, is if you tried to match whitespace that is not expressed as whitespace in your test, e.g. tabs: >>> def test2(): ... r""" ... >>> '\t\t ' # doctest: +NORMALIZE_WHITESPACE ... '\t' ... """ ... >>> doctest.testmod() ********************************************************************** File "/home/mg/.python", line 25, in __main__.test2 Failed example: '\t\t' # doctest: +NORMALIZE_WHITESPACE Expected: '\t' Got: '\t\t' ********************************************************************** 1 items had failures: 1 of 1 in __main__.test2 ***Test Failed*** 1 failures. *** DocTestRunner.merge: '__main__.test1' in both testers; summing outcomes. *** DocTestRunner.merge: '__main__' in both testers; summing outcomes. (1, 2) Marius Gedminas -- America and England are two countries separated by a common language.
signature.asc
Description: Digital signature
_______________________________________________ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com