[Zope3-dev] Re-normalizers instead of ellipses in doctests [was: some checkin]

Philipp von Weitershausen philipp at weitershausen.de
Wed Sep 26 17:52:42 EDT 2007


Marius Gedminas wrote:
> Log message for revision 80145:
>   Make the test pass on both Python 2.4 and 2.5.
>   
...
> -=-
> Modified: z3c.form/trunk/src/z3c/form/action.txt
> ===================================================================
> --- z3c.form/trunk/src/z3c/form/action.txt	2007-09-26 21:26:25 UTC (rev 80144)
> +++ z3c.form/trunk/src/z3c/form/action.txt	2007-09-26 21:49:09 UTC (rev 80145)
> @@ -236,4 +236,5 @@
>    <ActionErrorOccurred for <Action 'cancel' u'Cancel'>>
>  
>    >>> eventlog[-1].error
> -  <ActionExecutionError wrapping <zope.interface.exceptions.Invalid ...>>
> +  <ActionExecutionError wrapping ...Invalid...>
> +

It's too bad that Exception's __repr__ changed in Python 2.5. The reason 
is that it's a new-style class now, which is actually a benefit at the 
same time.

Anyway, these ellipses are very ugly and confusing. I think they're 
okay-ish when you know exactly what they're supposed to stand for. In 
this case we can definitely do better.

When Nikhil N made all of zope.*'s tests pass on Python 2.5, he did a 
good job of using re-normalizers. I very much suggest doing the same 
thing here. I see you use a re-normalizer already for some messages, so 
I won't have to show you how to use it :).


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


More information about the Zope3-dev mailing list