[Checkins] SVN: zope.location/trunk/ Moved doctest examples to Sphinx API reference.

Tres Seaver cvs-admin at zope.org
Thu Jun 7 01:31:56 UTC 2012


Log message for revision 126643:
  Moved doctest examples to Sphinx API reference.
  
  Converted 'zope.location.tests' to a package.
  

Changed:
  _U  zope.location/trunk/
  U   zope.location/trunk/CHANGES.txt
  A   zope.location/trunk/docs/api.rst
  U   zope.location/trunk/docs/conf.py
  U   zope.location/trunk/docs/index.rst
  U   zope.location/trunk/docs/narr.rst
  A   zope.location/trunk/src/zope/location/tests/
  A   zope.location/trunk/src/zope/location/tests/__init__.py
  A   zope.location/trunk/src/zope/location/tests/test_doctests.py
  D   zope.location/trunk/src/zope/location/tests.py
  U   zope.location/trunk/src/zope/location/traversing.py

-=-
Modified: zope.location/trunk/CHANGES.txt
===================================================================
--- zope.location/trunk/CHANGES.txt	2012-06-07 01:31:48 UTC (rev 126642)
+++ zope.location/trunk/CHANGES.txt	2012-06-07 01:31:52 UTC (rev 126643)
@@ -5,7 +5,7 @@
 4.0.0 (unreleased)
 ------------------
 
-- Added Sphinx documentation.
+- Added Sphinx documentation:  moved doctest examples to API reference.
 
 - Added 'setup.py docs' alias (installs ``Sphinx`` and dependencies).
 

Added: zope.location/trunk/docs/api.rst
===================================================================
--- zope.location/trunk/docs/api.rst	                        (rev 0)
+++ zope.location/trunk/docs/api.rst	2012-06-07 01:31:52 UTC (rev 126643)
@@ -0,0 +1,338 @@
+:mod:`zope.location` API
+========================
+
+:mod:`zope.location.interfaces`
+-------------------------------
+
+.. automodule:: zope.location.interfaces
+
+   .. autointerface:: ILocation
+      :members:
+      :member-order: bysource
+
+   .. autointerface:: IContained
+      :members:
+      :member-order: bysource
+
+   .. autointerface:: ILocationInfo
+      :members:
+      :member-order: bysource
+
+   .. autointerface:: ISublocations
+      :members:
+      :member-order: bysource
+
+   .. autointerface:: IRoot
+      :members:
+      :member-order: bysource
+
+   .. autoexception:: LocationError
+      :members:
+      :member-order: bysource
+
+:mod:`zope.location.location`
+-----------------------------
+
+.. automodule:: zope.location.location
+
+   .. autoclass:: Location
+      :members:
+      :member-order: bysource
+
+   .. autofunction:: locate
+
+   .. autofunction:: located
+
+   .. autofunction:: LocationIterator
+
+   .. autofunction:: inside
+
+   .. autoclass:: LocationProxy
+      :members:
+      :member-order: bysource
+
+:mod:`zope.location.traversing`
+-------------------------------
+
+.. automodule:: zope.location.traversing
+
+   .. autoclass:: LocationPhysicallyLocatable
+    
+      .. doctest::
+
+         >>> from zope.interface.verify import verifyObject
+         >>> from zope.location.interfaces import ILocationInfo
+         >>> from zope.location.location import Location
+         >>> from zope.location.traversing import LocationPhysicallyLocatable
+         >>> info = LocationPhysicallyLocatable(Location())
+         >>> verifyObject(ILocationInfo, info)
+         True
+
+      .. automethod:: getRoot
+
+         .. doctest::
+
+            >>> from zope.interface import directlyProvides
+            >>> from zope.location.interfaces import IRoot
+            >>> from zope.location.location import Location
+            >>> from zope.location.traversing import LocationPhysicallyLocatable
+            >>> root = Location()
+            >>> directlyProvides(root, IRoot)
+            >>> LocationPhysicallyLocatable(root).getRoot() is root
+            True
+
+            >>> o1 = Location(); o1.__parent__ = root
+            >>> LocationPhysicallyLocatable(o1).getRoot() is root
+            True
+
+            >>> o2 = Location(); o2.__parent__ = o1
+            >>> LocationPhysicallyLocatable(o2).getRoot() is root
+            True
+
+         We'll get a TypeError if we try to get the location fo a
+         rootless object:
+
+         .. doctest::
+
+            >>> o1.__parent__ = None
+            >>> LocationPhysicallyLocatable(o1).getRoot()
+            Traceback (most recent call last):
+            ...
+            TypeError: Not enough context to determine location root
+            >>> LocationPhysicallyLocatable(o2).getRoot()
+            Traceback (most recent call last):
+            ...
+            TypeError: Not enough context to determine location root
+
+         If we screw up and create a location cycle, it will be caught:
+
+         .. doctest::
+
+            >>> o1.__parent__ = o2
+            >>> LocationPhysicallyLocatable(o1).getRoot()
+            Traceback (most recent call last):
+            ...
+            TypeError: Maximum location depth exceeded, probably due to a a location cycle.
+
+      .. automethod:: getPath
+
+         .. doctest::
+
+            >>> from zope.interface import directlyProvides
+            >>> from zope.location.interfaces import IRoot
+            >>> from zope.location.location import Location
+            >>> from zope.location.traversing import LocationPhysicallyLocatable
+            >>> root = Location()
+            >>> directlyProvides(root, IRoot)
+            >>> LocationPhysicallyLocatable(root).getPath()
+            u'/'
+
+            >>> o1 = Location(); o1.__parent__ = root; o1.__name__ = 'o1'
+            >>> LocationPhysicallyLocatable(o1).getPath()
+            u'/o1'
+
+            >>> o2 = Location(); o2.__parent__ = o1; o2.__name__ = u'o2'
+            >>> LocationPhysicallyLocatable(o2).getPath()
+            u'/o1/o2'
+
+         It is an error to get the path of a rootless location:
+
+         .. doctest::
+
+            >>> o1.__parent__ = None
+            >>> LocationPhysicallyLocatable(o1).getPath()
+            Traceback (most recent call last):
+            ...
+            TypeError: Not enough context to determine location root
+
+            >>> LocationPhysicallyLocatable(o2).getPath()
+            Traceback (most recent call last):
+            ...
+            TypeError: Not enough context to determine location root
+
+         If we screw up and create a location cycle, it will be caught:
+
+         .. doctest::
+
+            >>> o1.__parent__ = o2
+            >>> LocationPhysicallyLocatable(o1).getPath()
+            Traceback (most recent call last):
+            ...
+            TypeError: Maximum location depth exceeded, """ \
+                    """probably due to a a location cycle.
+
+      .. automethod:: getParent
+
+         .. doctest::
+
+            >>> from zope.interface import directlyProvides
+            >>> from zope.location.interfaces import IRoot
+            >>> from zope.location.location import Location
+            >>> from zope.location.traversing import LocationPhysicallyLocatable
+            >>> root = Location()
+            >>> directlyProvides(root, IRoot)
+            >>> o1 = Location()
+            >>> o2 = Location()
+
+            >>> LocationPhysicallyLocatable(o2).getParent() # doctest: +ELLIPSIS
+            Traceback (most recent call last):
+            TypeError: ('Not enough context information to get parent', <zope.location.location.Location object at 0x...>)
+
+            >>> o1.__parent__ = root
+            >>> LocationPhysicallyLocatable(o1).getParent() == root
+            True
+
+            >>> o2.__parent__ = o1
+            >>> LocationPhysicallyLocatable(o2).getParent() == o1
+            True
+
+      .. automethod:: getParents
+
+         .. doctest::
+
+            >>> from zope.interface import directlyProvides
+            >>> from zope.interface import noLongerProvides
+            >>> from zope.location.interfaces import IRoot
+            >>> from zope.location.location import Location
+            >>> from zope.location.traversing import LocationPhysicallyLocatable
+            >>> root = Location()
+            >>> directlyProvides(root, IRoot)
+            >>> o1 = Location()
+            >>> o2 = Location()
+            >>> o1.__parent__ = root
+            >>> o2.__parent__ = o1
+            >>> LocationPhysicallyLocatable(o2).getParents() == [o1, root]
+            True
+            
+            If the last parent is not an IRoot object, TypeError will be
+            raised as statet before.
+            
+            >>> noLongerProvides(root, IRoot)
+            >>> LocationPhysicallyLocatable(o2).getParents()
+            Traceback (most recent call last):
+            ...
+            TypeError: Not enough context information to get all parents
+
+      .. automethod:: getName
+
+         .. doctest::
+
+            >>> from zope.location.location import Location
+            >>> from zope.location.traversing import LocationPhysicallyLocatable
+            >>> o1 = Location(); o1.__name__ = u'o1'
+            >>> LocationPhysicallyLocatable(o1).getName()
+            u'o1'
+
+      .. automethod:: getNearestSite
+
+         .. doctest::
+
+            >>> from zope.interface import directlyProvides
+            >>> from zope.component.interfaces import ISite
+            >>> from zope.location.interfaces import IRoot
+            >>> from zope.location.location import Location
+            >>> from zope.location.traversing import LocationPhysicallyLocatable
+            >>> o1 = Location()
+            >>> o1.__name__ = 'o1'
+            >>> LocationPhysicallyLocatable(o1).getNearestSite()
+            Traceback (most recent call last):
+            ...
+            TypeError: Not enough context information to get all parents
+
+            >>> root = Location()
+            >>> directlyProvides(root, IRoot)
+            >>> o1 = Location()
+            >>> o1.__name__ = 'o1'
+            >>> o1.__parent__ = root
+            >>> LocationPhysicallyLocatable(o1).getNearestSite() is root
+            True
+            
+            >>> directlyProvides(o1, ISite)
+            >>> LocationPhysicallyLocatable(o1).getNearestSite() is o1
+            True
+            
+            >>> o2 = Location()
+            >>> o2.__parent__ = o1
+            >>> LocationPhysicallyLocatable(o2).getNearestSite() is o1
+            True
+
+   .. autoclass:: RootPhysicallyLocatable
+    
+      .. doctest::
+
+         >>> from zope.interface.verify import verifyObject
+         >>> from zope.location.interfaces import ILocationInfo
+         >>> from zope.location.traversing import RootPhysicallyLocatable
+         >>> info = RootPhysicallyLocatable(None)
+         >>> verifyObject(ILocationInfo, info)
+         True
+
+      .. automethod:: getRoot
+
+         No need to search for root when our context is already root :) 
+
+         .. doctest::
+
+            >>> from zope.location.traversing import RootPhysicallyLocatable
+            >>> o1 = object()
+            >>> RootPhysicallyLocatable(o1).getRoot() is o1
+            True
+
+      .. automethod:: getPath
+
+         Root object is at the top of the tree, so always return ``/``. 
+
+         .. doctest::
+
+            >>> from zope.location.traversing import RootPhysicallyLocatable
+            >>> o1 = object()
+            >>> RootPhysicallyLocatable(o1).getPath()
+            u'/'
+
+      .. automethod:: getParent
+
+         Returns None if the object is a containment root.
+         Raises TypeError if the object doesn't have enough context to get the
+         parent.
+
+         .. doctest::
+
+            >>> from zope.location.traversing import RootPhysicallyLocatable
+            >>> o1 = object()
+            >>> RootPhysicallyLocatable(o1).getParent() is None
+            True
+
+      .. automethod:: getParents
+
+         There's no parents for the root object, return empty list.
+
+         .. doctest::
+
+            >>> from zope.location.traversing import RootPhysicallyLocatable
+            >>> o1 = object()
+            >>> RootPhysicallyLocatable(o1).getParents()
+            []
+
+      .. automethod:: getName
+
+         Always return empty unicode string for the root object
+
+         .. doctest::
+
+            >>> from zope.location.traversing import RootPhysicallyLocatable
+            >>> o1 = object()
+            >>> RootPhysicallyLocatable(o1).getName()
+            u''
+
+      .. automethod:: getNearestSite
+ 
+         Return object itself as the nearest site, because there's no
+         other place to look for. It's also usual that the root is the
+         site as well.
+
+         .. doctest::
+
+            >>> from zope.location.traversing import RootPhysicallyLocatable
+            >>> o1 = object()
+            >>> RootPhysicallyLocatable(o1).getNearestSite() is o1
+            True

Modified: zope.location/trunk/docs/conf.py
===================================================================
--- zope.location/trunk/docs/conf.py	2012-06-07 01:31:48 UTC (rev 126642)
+++ zope.location/trunk/docs/conf.py	2012-06-07 01:31:52 UTC (rev 126643)
@@ -25,7 +25,14 @@
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode']
+extensions = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.doctest',
+    'sphinx.ext.todo',
+    'sphinx.ext.ifconfig',
+    'sphinx.ext.viewcode',
+    'repoze.sphinx.autointerface',
+]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']

Modified: zope.location/trunk/docs/index.rst
===================================================================
--- zope.location/trunk/docs/index.rst	2012-06-07 01:31:48 UTC (rev 126642)
+++ zope.location/trunk/docs/index.rst	2012-06-07 01:31:52 UTC (rev 126643)
@@ -7,6 +7,7 @@
    :maxdepth: 2
 
    narr
+   api
 
 
 Indices and tables

Modified: zope.location/trunk/docs/narr.rst
===================================================================
--- zope.location/trunk/docs/narr.rst	2012-06-07 01:31:48 UTC (rev 126642)
+++ zope.location/trunk/docs/narr.rst	2012-06-07 01:31:52 UTC (rev 126643)
@@ -1,8 +1,8 @@
 Using :mod:`zope.location`
 ==========================
 
-Location Base Class
--------------------
+:class:`~zope.location.location.Location`
+-----------------------------------------
 
 The `Location` base class is a mix-in that defines `__parent__` and
 `__name__` attributes.
@@ -39,8 +39,8 @@
   WrongContainedType: ([WrongType('foo', <type 'unicode'>, '__name__')], 'location')
 
 
-The func:`~zope.location.location.inside` Function
---------------------------------------------------
+:func:`~zope.location.location.inside`
+--------------------------------------
 
 The `inside` function tells if l1 is inside l2.  L1 is inside l2 if l2 is an
 ancestor of l1.
@@ -148,8 +148,8 @@
   StopIteration
 
 
-The :func:`~zope.location.location.located` function
-----------------------------------------------------
+:func:`~zope.location.location.located`
+---------------------------------------
 
 `located` locates an object in another and returns it:
 

Added: zope.location/trunk/src/zope/location/tests/__init__.py
===================================================================
--- zope.location/trunk/src/zope/location/tests/__init__.py	                        (rev 0)
+++ zope.location/trunk/src/zope/location/tests/__init__.py	2012-06-07 01:31:52 UTC (rev 126643)
@@ -0,0 +1 @@
+#package

Copied: zope.location/trunk/src/zope/location/tests/test_doctests.py (from rev 126642, zope.location/trunk/src/zope/location/tests.py)
===================================================================
--- zope.location/trunk/src/zope/location/tests/test_doctests.py	                        (rev 0)
+++ zope.location/trunk/src/zope/location/tests/test_doctests.py	2012-06-07 01:31:52 UTC (rev 126643)
@@ -0,0 +1,30 @@
+##############################################################################
+#
+# Copyright (c) 2003-2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Location support tests
+"""
+
+import doctest
+import unittest
+
+
+def test_suite():
+    suite = unittest.TestSuite()
+    try:
+        import zope.configuration
+    except ImportError:
+        pass
+    else:
+        suite.addTest(doctest.DocFileSuite('configure.txt'))
+
+    return suite

Deleted: zope.location/trunk/src/zope/location/tests.py
===================================================================
--- zope.location/trunk/src/zope/location/tests.py	2012-06-07 01:31:48 UTC (rev 126642)
+++ zope.location/trunk/src/zope/location/tests.py	2012-06-07 01:31:52 UTC (rev 126643)
@@ -1,34 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003-2009 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Location support tests
-"""
-
-import doctest
-import unittest
-
-
-def test_suite():
-    suite = unittest.TestSuite((
-        doctest.DocFileSuite('location.txt'),
-        doctest.DocTestSuite('zope.location.traversing'),
-    ))
-
-    try:
-        import zope.configuration
-    except ImportError:
-        pass
-    else:
-        suite.addTest(doctest.DocFileSuite('configure.txt'))
-
-    return suite

Modified: zope.location/trunk/src/zope/location/traversing.py
===================================================================
--- zope.location/trunk/src/zope/location/traversing.py	2012-06-07 01:31:48 UTC (rev 126642)
+++ zope.location/trunk/src/zope/location/traversing.py	2012-06-07 01:31:52 UTC (rev 126643)
@@ -27,60 +27,12 @@
 @zope.component.adapter(ILocation)
 class LocationPhysicallyLocatable(object):
     """Provide location information for location objects
-    
-    >>> from zope.interface.verify import verifyObject
-    >>> info = LocationPhysicallyLocatable(Location())
-    >>> verifyObject(ILocationInfo, info)
-    True
-    
     """
-
-
     def __init__(self, context):
         self.context = context
 
     def getRoot(self):
-        """Get the root location for a location.
-
-        See ILocationInfo
-
-        The root location is a location that contains the given
-        location and that implements IContainmentRoot.
-
-        >>> root = Location()
-        >>> zope.interface.directlyProvides(root, IRoot)
-        >>> LocationPhysicallyLocatable(root).getRoot() is root
-        True
-
-        >>> o1 = Location(); o1.__parent__ = root
-        >>> LocationPhysicallyLocatable(o1).getRoot() is root
-        True
-
-        >>> o2 = Location(); o2.__parent__ = o1
-        >>> LocationPhysicallyLocatable(o2).getRoot() is root
-        True
-
-        We'll get a TypeError if we try to get the location fo a
-        rootless object:
-
-        >>> o1.__parent__ = None
-        >>> LocationPhysicallyLocatable(o1).getRoot()
-        Traceback (most recent call last):
-        ...
-        TypeError: Not enough context to determine location root
-        >>> LocationPhysicallyLocatable(o2).getRoot()
-        Traceback (most recent call last):
-        ...
-        TypeError: Not enough context to determine location root
-
-        If we screw up and create a location cycle, it will be caught:
-
-        >>> o1.__parent__ = o2
-        >>> LocationPhysicallyLocatable(o1).getRoot()
-        Traceback (most recent call last):
-        ...
-        TypeError: Maximum location depth exceeded, """ \
-                """probably due to a a location cycle.
+        """See ILocationInfo.
         """
         context = self.context
         max = 9999
@@ -96,47 +48,7 @@
         raise TypeError("Not enough context to determine location root")
 
     def getPath(self):
-        """Get the path of a location.
-
-        See ILocationInfo
-
-        This is an "absolute path", rooted at a root object.
-
-        >>> root = Location()
-        >>> zope.interface.directlyProvides(root, IRoot)
-        >>> LocationPhysicallyLocatable(root).getPath()
-        u'/'
-
-        >>> o1 = Location(); o1.__parent__ = root; o1.__name__ = 'o1'
-        >>> LocationPhysicallyLocatable(o1).getPath()
-        u'/o1'
-
-        >>> o2 = Location(); o2.__parent__ = o1; o2.__name__ = u'o2'
-        >>> LocationPhysicallyLocatable(o2).getPath()
-        u'/o1/o2'
-
-        It is an error to get the path of a rootless location:
-
-        >>> o1.__parent__ = None
-        >>> LocationPhysicallyLocatable(o1).getPath()
-        Traceback (most recent call last):
-        ...
-        TypeError: Not enough context to determine location root
-
-        >>> LocationPhysicallyLocatable(o2).getPath()
-        Traceback (most recent call last):
-        ...
-        TypeError: Not enough context to determine location root
-
-        If we screw up and create a location cycle, it will be caught:
-
-        >>> o1.__parent__ = o2
-        >>> LocationPhysicallyLocatable(o1).getPath()
-        Traceback (most recent call last):
-        ...
-        TypeError: Maximum location depth exceeded, """ \
-                """probably due to a a location cycle.
-
+        """See ILocationInfo.
         """
 
         path = []
@@ -160,29 +72,7 @@
         raise TypeError("Not enough context to determine location root")
 
     def getParent(self):
-        """Returns the container the object was traversed via.
-
-        Returns None if the object is a containment root.
-        Raises TypeError if the object doesn't have enough context to get the
-        parent.
-
-        >>> root = Location()
-        >>> zope.interface.directlyProvides(root, IRoot)
-        >>> o1 = Location()
-        >>> o2 = Location()
-
-        >>> LocationPhysicallyLocatable(o2).getParent() # doctest: +ELLIPSIS
-        Traceback (most recent call last):
-        TypeError: ('Not enough context information to get parent', <zope.location.location.Location object at 0x...>)
-
-        >>> o1.__parent__ = root
-        >>> LocationPhysicallyLocatable(o1).getParent() == root
-        True
-
-        >>> o2.__parent__ = o1
-        >>> LocationPhysicallyLocatable(o2).getParent() == o1
-        True
-
+        """See ILocationInfo.
         """
         parent = getattr(self.context, '__parent__', None)
         if parent is not None:
@@ -192,30 +82,7 @@
                         self.context)
 
     def getParents(self):
-        """Returns a list starting with the object's parent followed by
-        each of its parents.
-
-        Raises a TypeError if the object is not connected to a containment
-        root.
-
-        >>> root = Location()
-        >>> zope.interface.directlyProvides(root, IRoot)
-        >>> o1 = Location()
-        >>> o2 = Location()
-        >>> o1.__parent__ = root
-        >>> o2.__parent__ = o1
-        >>> LocationPhysicallyLocatable(o2).getParents() == [o1, root]
-        True
-        
-        If the last parent is not an IRoot object, TypeError will be
-        raised as statet before.
-        
-        >>> zope.interface.noLongerProvides(root, IRoot)
-        >>> LocationPhysicallyLocatable(o2).getParents()
-        Traceback (most recent call last):
-        ...
-        TypeError: Not enough context information to get all parents
-
+        """See ILocationInfo.
         """
         # XXX Merge this implementation with getPath. This was refactored
         # from zope.traversing.
@@ -233,44 +100,12 @@
         raise TypeError("Not enough context information to get all parents")
 
     def getName(self):
-        """Get a location name
-
-        See ILocationInfo
-
-        >>> o1 = Location(); o1.__name__ = u'o1'
-        >>> LocationPhysicallyLocatable(o1).getName()
-        u'o1'
+        """See ILocationInfo
         """
         return self.context.__name__
 
     def getNearestSite(self):
-        """return the nearest site, see ILocationInfo
-
-        >>> o1 = Location()
-        >>> o1.__name__ = 'o1'
-        >>> LocationPhysicallyLocatable(o1).getNearestSite()
-        Traceback (most recent call last):
-        ...
-        TypeError: Not enough context information to get all parents
-
-        >>> root = Location()
-        >>> zope.interface.directlyProvides(root, IRoot)
-        >>> o1 = Location()
-        >>> o1.__name__ = 'o1'
-        >>> o1.__parent__ = root
-        >>> LocationPhysicallyLocatable(o1).getNearestSite() is root
-        True
-        
-        >>> zope.interface.directlyProvides(
-        ...     o1, zope.component.interfaces.ISite)
-        >>> LocationPhysicallyLocatable(o1).getNearestSite() is o1
-        True
-        
-        >>> o2 = Location()
-        >>> o2.__parent__ = o1
-        >>> LocationPhysicallyLocatable(o2).getNearestSite() is o1
-        True
-        
+        """See ILocationInfo
         """
         if zope.component.interfaces.ISite.providedBy(self.context):
             return self.context
@@ -284,15 +119,9 @@
 class RootPhysicallyLocatable(object):
     """Provide location information for the root object
     
-    >>> from zope.interface.verify import verifyObject
-    >>> info = RootPhysicallyLocatable(None)
-    >>> verifyObject(ILocationInfo, info)
-    True
-    
     This adapter is very simple, because there's no places to search
     for parents and nearest sites, so we are only working with context
     object, knowing that its the root object already.
-    
     """
 
 
@@ -301,76 +130,30 @@
 
     def getRoot(self):
         """See ILocationInfo
-
-        No need to search for root when our context is already root :) 
-
-        >>> o1 = object()
-        >>> RootPhysicallyLocatable(o1).getRoot() is o1
-        True
-        
         """
         return self.context
 
     def getPath(self):
         """See ILocationInfo
-
-        Root object is at the top of the tree, so always return ``/``. 
-
-        >>> o1 = object()
-        >>> RootPhysicallyLocatable(o1).getPath()
-        u'/'
-        
         """
         return u'/'
 
-    def getName(self):
-        """See ILocationInfo
-
-        Always return empty unicode string for the root object
-
-        >>> o1 = object()
-        >>> RootPhysicallyLocatable(o1).getName()
-        u''
-        
-        """
-        return u''
-
     def getParent(self):
-        """Returns the container the object was traversed via.
-
-        Returns None if the object is a containment root.
-        Raises TypeError if the object doesn't have enough context to get the
-        parent.
-
-        >>> o1 = object()
-        >>> RootPhysicallyLocatable(o1).getParent()
-
+        """See ILocationInfo.
         """
         return None
 
     def getParents(self):
         """See ILocationInfo
-
-        There's no parents for the root object, return empty list.
-
-        >>> o1 = object()
-        >>> RootPhysicallyLocatable(o1).getParents()
-        []
-        
         """
         return []
 
-    def getNearestSite(self):
+    def getName(self):
         """See ILocationInfo
-        
-        Return object itself as the nearest site, because there's no
-        other place to look for. It's also usual that the root is the
-        site as well.
-        
+        """
+        return u''
 
-        >>> o1 = object()
-        >>> RootPhysicallyLocatable(o1).getNearestSite() is o1
-        True
-        
+    def getNearestSite(self):
+        """See ILocationInfo
         """
         return self.context



More information about the checkins mailing list