Tres Seaver wrote:
> >>>Well, if you look closer you find that it uses pprint.pformat which always 
> >>>outputs
> >>>the same on all machines (because it provides output sorted by the 
> >>>dictionary key).
> >>
> >>I see that in the implementation;  it isn't documented as part of
> >>pprint's contract, however.
> >
> >
> > Yes it is:
> I must be blind, but I don't see any occurrence of 'sort' on that page
> or on the "PrettyPrinter Objects" page under it, nor in the pydoc output
> nor the module docstring.

Now I see what you mean by "contract". You're right, I guess it isn't 
documented then, but
perhaps it should be.

> >>But the dictionary here is an *artifact* -- what you are really trying
> >>to do would be expressed as individual assertions in a classic unit test:
> >>
> >>  self.failUnless(IFiveUtilityRegistry.providedBy(utility_service))
> >>  self.failIf(zapi.getSiteManager() is zapi.getGlobalSiteManager())
> >>
> >>etc.  If you really want to test equality of dictionaries, then
> >>'self.assertEqual' does the trick just fine.
> >
> >
> > All I need is a means to get information from the view (which is our 
> > guinnea pig
> > component that tries to look up local stuff) to the functional test. Views 
> > typically
> > output strings, whether we're in doctests or not. So, in the end we're 
> > comparing
> > strings. pprint'ing a dictionary is just a convenient, but perhaps 
> > misleading way of
> > doing this.
> In that case, I would have added methods to the view and asserted their
> return values, I think, even in a doctest.  De gustibus, perhaps.

Yup, I should probably do this.


This message was sent using IMP, the Internet Messaging Program.
Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to