[Zope3-dev] Re: doctest prb again

Philipp von Weitershausen philipp at weitershausen.de
Fri Jul 20 05:30:08 EDT 2007


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. Doing this::

  >>> print '   '
  <three spaces>

will invoke it, though.


> Friday, July 20, 2007, 10:25:02 AM, you wrote:
>> On Fri, Jul 20, 2007 at 10:09:18AM +0200, Adam Groszer wrote:
>>> Hello,
>>>
>>> How to solve the \r\n and \n mismatch between win32 and *nix in the
>>> doctests?
>>>
>>> doctest is:
>>> """
>>>     >>> ctrl.value
>>>     '        Text inside\n        area!\n      '
>>> """
>>>
>>> fails with (on win32):
>>> """
>>> Failed example:
>>>     ctrl.value
>>> Expected:
>>>     '        Text inside\n        area!\n      '
>>> Got:
>>>     '          Text inside\r\n          area!\r\n        '
>>> """
>>>
>>> ctrl.value comes from a html file in zope.testbrowser.ftests
> 
>> You could do
> 
>>     >>> ctrl.value.replace('\r', '')
> 
>> or strip the \r's in the place where you're reading that html file.
> 
>> Marius Gedminas
> 


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Zope3-dev mailing list