[Checkins] SVN: zope.copy/trunk/src/zope/copy/ Revert the README.txt doctest to it's original state by reseting the component registry between tests - it makes more sense that way.

Laurence Rowe l at lrowe.co.uk
Thu Aug 19 12:21:25 EDT 2010


Log message for revision 115802:
  Revert the README.txt doctest to it's original state by reseting the component registry between tests - it makes more sense that way.

Changed:
  U   zope.copy/trunk/src/zope/copy/README.txt
  U   zope.copy/trunk/src/zope/copy/tests.py

-=-
Modified: zope.copy/trunk/src/zope/copy/README.txt
===================================================================
--- zope.copy/trunk/src/zope/copy/README.txt	2010-08-19 14:33:15 UTC (rev 115801)
+++ zope.copy/trunk/src/zope/copy/README.txt	2010-08-19 16:21:24 UTC (rev 115802)
@@ -186,7 +186,7 @@
 -----------------------
 
 One thing we didn't examine yet is the use of ResumeCopy exception in
-the copy hooks. For example, when copying located objects we want
+the copy hooks. For example, when copying located objects we don't want
 to copy referenced subobjects that are not located in the object that
 is being copied. Imagine, we have a content object that has an image object,
 referenced by the ``cover`` attribute, but located in an independent
@@ -202,14 +202,16 @@
 
     >>> content.cover = image
   
-With the standard hook from zope.location the image object will be copied:
+Without any hooks, the image object will be cloned as well:
 
     >>> new = zope.copy.copy(content)
-    >>> new.cover is not image
+    >>> new.cover is image
     False
 
-Now we can see how the ResumeCopy exception works, by creating a copy hook
-from scratch.
+That's not what we'd expect though, so, let's provide a copy hook
+to deal with that. The copy hook for this case is provided by zope.location
+package, but we'll create one from scratch as we want to check out the
+usage of the ResumeCopy. 
 
     >>> @zope.component.adapter(zope.location.interfaces.ILocation)
     ... @zope.interface.implementer(zope.copy.interfaces.ICopyHook)

Modified: zope.copy/trunk/src/zope/copy/tests.py
===================================================================
--- zope.copy/trunk/src/zope/copy/tests.py	2010-08-19 14:33:15 UTC (rev 115801)
+++ zope.copy/trunk/src/zope/copy/tests.py	2010-08-19 16:21:24 UTC (rev 115802)
@@ -14,6 +14,7 @@
 """Tests for the zope.copy package.
 """
 import unittest
+import zope.component.testing
 from zope.testing import doctest, module
 
 def setUp(test):
@@ -21,6 +22,7 @@
 
 def tearDown(test):
     module.tearDown(test)
+    zope.component.testing.tearDown()
 
 def test_suite():
     return unittest.TestSuite((



More information about the checkins mailing list