-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Philipp von Weitershausen wrote:
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
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.
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. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDptwT+gerLs4ltQ4RAopbAJ0UVEeeLZ0tZ4pMu2TBAAoYFy+60gCgyeUf BU+mhROlfBZ546O7hgoDZ1E= =qMNh -----END PGP SIGNATURE-----