On Tue, Dec 22, 2009 at 10:26, Marius Gedminas <marius@gedmin.as> wrote:
On Mon, Dec 21, 2009 at 10:27:01PM +0100, Lennart Regebro wrote:
I added the imports back, and also some deprecation warnings, although I'm not sure how to best add them,
Maybe zope.deprecation can help?
I didn't find anything obvious.
The warning in zope.testing.doctestunit says "zope.testing.doctest is deprecated", I think it should say "doctestunit".
Oups.
I fixed that in svn (and added stacklevel=2, so you can see where in your code those modules are imported).
Ah, right. Forgot that.
Should zope.testing.doctestunit.pprint be deprecated?
It's trying to fix a misfeature of stdlib's pprint.pprint, which is that pprinting a dict will output its repr() if len(repr(a_dict)) is narrower than the desired wrapping width. The order of keys and values of a dict's repr() is not well-defined, which tends to cause issues for doctests. zope.testing.doctestunit.pprint works around it by hardcoding the wrapping width to 1, which results in somewhat ugly output, but forces the stdlib's pretty-printer to sort dict keys alphabetically.
Aha.
I don't have strong feelings one way or another. I have 18 test files that use zope.testing.doctestunit.pprint, but since I always found its output ugly, I wouldn't mind writing some custom dict printing functions.
I have no opinion either, I don't use it, but it does seem slightly practical. -- Lennart Regebro: http://regebro.wordpress.com/ Python 3 Porting: http://python-incompatibility.googlecode.com/ +33 661 58 14 64