[Zope3-checkins] SVN: Zope3/trunk/src/zope/location/traversing.py Added missing doctest for `getNearestSite` method in

Baiju M baiju.m.mail at gmail.com
Mon Oct 9 04:05:44 EDT 2006


Log message for revision 70581:
  Added missing doctest for `getNearestSite` method in
  zope.location.traversing.LocationPhysicallyLocatable
  

Changed:
  U   Zope3/trunk/src/zope/location/traversing.py

-=-
Modified: Zope3/trunk/src/zope/location/traversing.py
===================================================================
--- Zope3/trunk/src/zope/location/traversing.py	2006-10-08 20:43:41 UTC (rev 70580)
+++ Zope3/trunk/src/zope/location/traversing.py	2006-10-09 08:05:38 UTC (rev 70581)
@@ -166,7 +166,23 @@
         return self.context.__name__
 
     def getNearestSite(self):
-        """return the nearest site, see IPhysicallyLocatable"""
+        """return the nearest site, see IPhysicallyLocatable
+
+        >>> 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, IContainmentRoot)
+        >>> o1 = Location()
+        >>> o1.__name__ = 'o1'
+        >>> o1.__parent__ = root
+        >>> LocationPhysicallyLocatable(o1).getNearestSite() is root
+        1
+        """
         if ISite.providedBy(self.context):
             return self.context
         for parent in getParents(self.context):



More information about the Zope3-Checkins mailing list