[Zope3-checkins] CVS: Zope3/src/zope/app/apidoc/ifacemodule - menu.py:1.3

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Mar 28 18:40:45 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/apidoc/ifacemodule
In directory cvs.zope.org:/tmp/cvs-serv22686/src/zope/app/apidoc/ifacemodule

Modified Files:
	menu.py 
Log Message:


Added and cleaned up tests.




=== Zope3/src/zope/app/apidoc/ifacemodule/menu.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/apidoc/ifacemodule/menu.py:1.2	Tue Mar  2 12:51:47 2004
+++ Zope3/src/zope/app/apidoc/ifacemodule/menu.py	Sun Mar 28 18:40:44 2004
@@ -45,9 +45,7 @@
 
     Usage::
 
-      >>> from zope.app.apidoc.ifacemodule import tests
       >>> from zope.app.apidoc.ifacemodule import InterfaceModule
-      >>> tests.setUp()
 
       >>> module = Module(InterfaceModule(), 'zope.app')
       >>> module.get('apidoc.interfaces.IDocumentationModule').getName()
@@ -59,8 +57,6 @@
 
       >>> print '\n'.join([id for id, iface in module.items()])
       zope.app.apidoc.interfaces.IDocumentationModule
-
-      >>> tests.tearDown()
     """
     
     implements(IModule)
@@ -89,9 +85,8 @@
 
     Functionality::
 
-      >>> from zope.app.apidoc.ifacemodule import tests
       >>> from zope.app.apidoc.ifacemodule import InterfaceModule
-      >>> tests.setUp()
+      >>> from zope.app.apidoc.ifacemodule import tests
 
       >>> module = InterfaceModule()
       >>> module = tests.rootLocation(module, 'Interface')
@@ -102,8 +97,6 @@
       >>> print '\n'.join([c.__name__ for c in adapter.getChildObjects()])
       IInterfaceModule
       zope.app.apidoc.interfaces
-
-      >>> tests.tearDown()      
     """
 
     implements(IChildObjects)
@@ -143,6 +136,31 @@
     A class that helps building the menu. The menu_macros expects the menu view
     class to have the getMenuTitle(node) and getMenuLink(node) methods
     implemented. 'node' is a 'zope.app.tree.node.Node' instance.
+
+    Examples::
+
+      >>> from zope.app.apidoc.ifacemodule import InterfaceModule
+      >>> from zope.app.apidoc.ifacemodule.tests import Root
+      >>> from zope.app.tree.node import Node 
+
+      >>> ifacemod = InterfaceModule()
+      >>> ifacemod.__parent__ = Root()
+      >>> ifacemod.__name__ = 'Interfaces'
+      >>> mod = Module(ifacemod, 'zope.app.apidoc.interfaces')
+      >>> menu = Menu()
+
+      >>> node = Node(mod.get('IDocumentationModule'))
+      >>> menu.getMenuTitle(node)
+      'zope.app.apidoc.interfaces.IDocumentationModule'
+
+      >>> values = mod.values()
+      >>> values.sort()
+      >>> node = Node(values[0])
+      >>> menu.getMenuTitle(node)
+      'IDocumentationModule'
+
+      >>> menu.getMenuLink(node)
+      './zope.app.apidoc.interfaces.IDocumentationModule/apiindex.html'
     """
 
     def getMenuTitle(self, node):
@@ -156,5 +174,4 @@
         """Return the HTML link of the node that is displayed in the menu."""
         if isinstance(removeAllProxies(node.context), Module):
             return None
-
         return './' + zapi.name(node.context) + '/apiindex.html'




More information about the Zope3-Checkins mailing list