[Zope-dev] Re: Unit Test Failures
Philipp von Weitershausen
philipp at weitershausen.de
Mon Dec 19 10:58:18 EST 2005
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: http://python.org/doc/current/lib/module-pprint.html
> 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.
Philipp
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Zope-Dev
mailing list