[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/apidoc/viewmodule/
Fixed apidoc doctests that depended on the order of items in a dict.
Derrick Hudson
dman at dman13.dyndns.org
Wed Feb 16 15:34:29 EST 2005
Log message for revision 29170:
Fixed apidoc doctests that depended on the order of items in a dict.
The test suite now passes with python 2.4 in additon to 2.3.
Changed:
U Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py
U Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py
-=-
Modified: Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py 2005-02-16 18:27:27 UTC (rev 29169)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/__init__.py 2005-02-16 20:34:28 UTC (rev 29170)
@@ -137,7 +137,7 @@
>>> doc.default
False
>>> pprint(doc.layers)
- [LayerDocumentation(u'layer3'), LayerDocumentation(u'layer2')]
+ [LayerDocumentation(u'layer2'), LayerDocumentation(u'layer3')]
>>> doc.interface
'zope.app.apidoc.viewmodule.tests.SkinC'
"""
@@ -174,6 +174,8 @@
for reg in sm.registrations()
if reg.provided is ILayer and reg.name != '' and \
self.context.component.isOrExtends(reg.component)]
+ # Ensure a consistent ordering of the layers
+ layers.sort()
# Make sure skins have a location
[locate(layer, self, layer.name) for layer in layers]
@@ -265,3 +267,11 @@
def __repr__(self):
"""Representation of the object in a doctest-friendly format."""
return '%s(%r)' % (self.__class__.__name__, self.name)
+
+ def __lt__(self, other) :
+ """Define this so a list of LayerDocumention objects can be sorted."""
+ if isinstance(other, LayerDocumentation) :
+ return self.name < other.name
+ else :
+ return NotImplemented
+
Modified: Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py 2005-02-16 18:27:27 UTC (rev 29169)
+++ Zope3/trunk/src/zope/app/apidoc/viewmodule/browser.py 2005-02-16 20:34:28 UTC (rev 29170)
@@ -98,7 +98,7 @@
>>> pprint(skins)
[SkinDocumentation(u'skinA', []),
SkinDocumentation(u'skinB', [u'layer1', u'layer2']),
- SkinDocumentation(u'skinC', [u'layer3', u'layer2'])]
+ SkinDocumentation(u'skinC', [u'layer2', u'layer3'])]
"""
skins = self.context.getSkins()
if columns:
More information about the Zope3-Checkins
mailing list