[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/DependencyFramework/tests - testDependable.py:1.2 BaseTestIDependable.py:NONE

Jim Fulton jim@zope.com
Mon, 18 Nov 2002 17:25:17 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/DependencyFramework/tests
In directory cvs.zope.org:/tmp/cvs-serv15653/DependencyFramework/tests

Modified Files:
	testDependable.py 
Removed Files:
	BaseTestIDependable.py 
Log Message:
Merged the finishing of the dependency framework from the 
Zope3-Bangalore-TTW-Branch.

Dependable is now an adapter for annotatable objects to register and
track dependencies.


=== Zope3/lib/python/Zope/App/DependencyFramework/tests/testDependable.py 1.1 => 1.2 ===
--- Zope3/lib/python/Zope/App/DependencyFramework/tests/testDependable.py:1.1	Mon Oct 14 07:51:05 2002
+++ Zope3/lib/python/Zope/App/DependencyFramework/tests/testDependable.py	Mon Nov 18 17:25:17 2002
@@ -17,15 +17,40 @@
 
 $Id$
 """
-from BaseTestIDependable import BaseTestIDependable
+
 from unittest import TestCase, TestSuite, main, makeSuite
+from Zope.App.OFS.Annotation.AttributeAnnotations \
+     import AttributeAnnotations
+from Zope.App.tests.PlacelessSetup import PlacelessSetup
+class C:pass
 
-class Test(BaseTestIDependable, TestCase):
+class Test(PlacelessSetup, TestCase):
 
+    
     def _Test__new(self):
         from Zope.App.DependencyFramework.Dependable import Dependable
-        return Dependable()
+        return Dependable(AttributeAnnotations(C()))
+
+    def testVerifyInterface(self):
+        from Interface.Verify import verifyObject
+        from Zope.App.DependencyFramework.IDependable import IDependable
+        object = self._Test__new()
+        verifyObject(IDependable, object)
 
+    def test(self):
+        dependable = self._Test__new()
+        self.failIf(dependable.dependents())
+        dependable.addDependent('/a/b')
+        dependable.addDependent('/c/d')
+        dependable.addDependent('/c/e')
+        dependents = list(dependable.dependents())
+        dependents.sort()
+        self.assertEqual(dependents, ['/a/b', '/c/d', '/c/e'])
+        dependable.removeDependent('/c/d')
+        dependents = list(dependable.dependents())
+        dependents.sort()
+        self.assertEqual(dependents, ['/a/b', '/c/e'])
+ 
 def test_suite():
     return TestSuite((
         makeSuite(Test),

=== Removed File Zope3/lib/python/Zope/App/DependencyFramework/tests/BaseTestIDependable.py ===