[Checkins] SVN: zope.location/trunk/ 100% unit test coverage.

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


Log message for revision 126649:
  100% unit test coverage.

Changed:
  _U  zope.location/trunk/
  U   zope.location/trunk/CHANGES.txt
  U   zope.location/trunk/src/zope/location/traversing.py

-=-
Modified: zope.location/trunk/CHANGES.txt
===================================================================
--- zope.location/trunk/CHANGES.txt	2012-06-07 01:32:11 UTC (rev 126648)
+++ zope.location/trunk/CHANGES.txt	2012-06-07 01:32:16 UTC (rev 126649)
@@ -5,6 +5,8 @@
 4.0.0 (unreleased)
 ------------------
 
+- 100% unit test coverage.
+
 - Added Sphinx documentation:  moved doctest examples to API reference.
 
 - Added 'setup.py docs' alias (installs ``Sphinx`` and dependencies).

Modified: zope.location/trunk/src/zope/location/traversing.py
===================================================================
--- zope.location/trunk/src/zope/location/traversing.py	2012-06-07 01:32:11 UTC (rev 126648)
+++ zope.location/trunk/src/zope/location/traversing.py	2012-06-07 01:32:16 UTC (rev 126649)
@@ -15,16 +15,17 @@
 """
 __docformat__ = 'restructuredtext'
 
-import zope.component
-import zope.component.interfaces
-import zope.interface
+from zope.component import adapter
+from zope.component.interfaces import ISite
+from zope.interface import implementer
+
+from zope.location.interfaces import ILocation
 from zope.location.interfaces import ILocationInfo
-from zope.location.interfaces import ILocation, IRoot
-from zope.location.location import Location
+from zope.location.interfaces import IRoot
 
 
- at zope.interface.implementer(ILocationInfo)
- at zope.component.adapter(ILocation)
+ at implementer(ILocationInfo)
+ at adapter(ILocation)
 class LocationPhysicallyLocatable(object):
     """Provide location information for location objects
     """
@@ -50,7 +51,6 @@
     def getPath(self):
         """See ILocationInfo.
         """
-
         path = []
         context = self.context
         max = 9999
@@ -89,7 +89,7 @@
         parents = []
         w = self.context
         while 1:
-            w = w.__parent__
+            w = getattr(w, '__parent__', None)
             if w is None:
                 break
             parents.append(w)
@@ -107,15 +107,15 @@
     def getNearestSite(self):
         """See ILocationInfo
         """
-        if zope.component.interfaces.ISite.providedBy(self.context):
+        if ISite.providedBy(self.context):
             return self.context
         for parent in self.getParents():
-            if zope.component.interfaces.ISite.providedBy(parent):
+            if ISite.providedBy(parent):
                 return parent
         return self.getRoot()
 
- at zope.interface.implementer(ILocationInfo)
- at zope.component.adapter(IRoot)
+ at implementer(ILocationInfo)
+ at adapter(IRoot)
 class RootPhysicallyLocatable(object):
     """Provide location information for the root object
     



More information about the checkins mailing list