[Zope3-checkins] CVS: Zope3/src/zope/interface/tests - test_declarations.py:1.8 test_odd_declarations.py:1.4

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Aug 15 21:45:22 EDT 2003


Update of /cvs-repository/Zope3/src/zope/interface/tests
In directory cvs.zope.org:/tmp/cvs-serv20171/interface/tests

Modified Files:
	test_declarations.py test_odd_declarations.py 
Log Message:
Merging dreamcatcher's TTW Schema branch:

1. Fixed Bug in adding that would cause infinite loops when the menu items
   action was not a valif view or factory id.

2. Extended adding to support more complex views. Until now we only 
   supported constructions like "+/AddView=id". Now you are able to say
   "+/AddView/More=id", which means that more information can be carried 
   in the URL. This can be used in many ways, including multi-page adding
   wizards. In my case I needed it to pass in the type of the TTW Schema-
   based Content Component.

3. Added Local Menus. This was a pain in the butt, but I think I got a 
   fairly nice model, where you can create local Menu Services, and Menus
   are simply named utilities. When active they are menus in the menu 
   service. This is very similar to the local interface service and TTW 
   Schema. 

4. Made some modifications to TTW Schema, cleaned up the code and moved
   the browser code and interfaces to the places they belong.

5. Added a Content Component Definition utility component, which takes a
   Schema and creates a content component for it, including permission
   settings and a menu entry. Currently the menu entry is always made to
   a local 'add_content' menu. I will change this and make it actually a
   screen, where the menu and title of the menu item can be chosen by the
   developer. Mmmh, should I add a factory for the definition as well, so
   that the content component is also available via python?

6. Added a Content Component Instance component that represents an 
   instance od a Content Component Definition. You will never directly 
   encounter this component, since it is automatically used by the adding
   code of the Content Component Definition.

7. Cleanups by both dreamcatcher and myself.

That's it. For more details see the branch checkin messages. I now consider
the dreamcatcher-ttwschema-branch closed.


=== Zope3/src/zope/interface/tests/test_declarations.py 1.7 => 1.8 ===
--- Zope3/src/zope/interface/tests/test_declarations.py:1.7	Wed Jun  4 18:25:00 2003
+++ Zope3/src/zope/interface/tests/test_declarations.py	Fri Aug 15 20:44:48 2003
@@ -94,7 +94,7 @@
         self.assert_(C3.__implements__.__class__ is tuple)
 
         self.assertEqual(
-            [i.__name__ for i in providedBy(C3())],
+            [i.getName() for i in providedBy(C3())],
             ['I3', 'I2', 'I5'],
             )
 
@@ -102,18 +102,18 @@
             implements(I4)
 
         self.assertEqual(
-            [i.__name__ for i in providedBy(C4())],
+            [i.getName() for i in providedBy(C4())],
             ['I4', 'I3', 'I2', 'I5'],
             )
 
         self.assertEqual(
-            [i.__name__ for i in C4.__implements__],
+            [i.getName() for i in C4.__implements__],
             ['I4', 'I3', 'I2', 'I5'],
             )
 
         # Note that C3.__implements__ should now be a sequence of interfaces
         self.assertEqual(
-            [i.__name__ for i in C3.__implements__],
+            [i.getName() for i in C3.__implements__],
             ['I3', 'I2', 'I5'],
             )
         self.failIf(C3.__implements__.__class__ is tuple)
@@ -135,12 +135,12 @@
             implements(I2)
 
         x = 42
-        self.assertEqual([i.__name__ for i in providedBy(x)],
+        self.assertEqual([i.getName() for i in providedBy(x)],
                          ['I1'])
 
         x = myint(42)
         directlyProvides(x, I3)
-        self.assertEqual([i.__name__ for i in providedBy(x)],
+        self.assertEqual([i.getName() for i in providedBy(x)],
                          ['I3', 'I2', 'I1'])
 
         # cleanup
@@ -148,7 +148,7 @@
         _implements_reg.clear()
 
         x = 42
-        self.assertEqual([i.__name__ for i in providedBy(x)],
+        self.assertEqual([i.getName() for i in providedBy(x)],
                          [])
         
 
@@ -244,17 +244,17 @@
     ...   implements(I1)
     >>> class B(A):
     ...   implements(I2)
-    >>> names =  [i.__name__ for i in implementedBy(B)]
+    >>> names =  [i.getName() for i in implementedBy(B)]
     >>> names
     ['I2', 'I1']
     >>> old = B.__dict__['__implements__']
     >>> new = loads(dumps(old))
-    >>> names =  [i.__name__ for i in new]
+    >>> names =  [i.getName() for i in new]
     >>> names
     ['I2']
     >>> classImplements(A, I3)
     >>> B.__implements__ = new
-    >>> names =  [i.__name__ for i in implementedBy(B)]
+    >>> names =  [i.getName() for i in implementedBy(B)]
     >>> names
     ['I2', 'I1', 'I3']
     
@@ -267,17 +267,17 @@
     ...   implements(I1)
     >>> class B(A):
     ...   implementsOnly(I2)
-    >>> names =  [i.__name__ for i in implementedBy(B)]
+    >>> names =  [i.getName() for i in implementedBy(B)]
     >>> names
     ['I2']
     >>> old = B.__dict__['__implements__']
     >>> new = loads(dumps(old))
-    >>> names =  [i.__name__ for i in new]
+    >>> names =  [i.getName() for i in new]
     >>> names
     ['I2']
     >>> classImplements(A, I3)
     >>> B.__implements__ = new
-    >>> names =  [i.__name__ for i in implementedBy(B)]
+    >>> names =  [i.getName() for i in implementedBy(B)]
     >>> names
     ['I2']
     


=== Zope3/src/zope/interface/tests/test_odd_declarations.py 1.3 => 1.4 ===
--- Zope3/src/zope/interface/tests/test_odd_declarations.py:1.3	Tue May  6 07:08:01 2003
+++ Zope3/src/zope/interface/tests/test_odd_declarations.py	Fri Aug 15 20:44:48 2003
@@ -44,41 +44,41 @@
 
 class A(Odd):
     implements(I1)
-    
+
 class C(A, B):
     implements(I31)
 
 
 class Test(unittest.TestCase):
 
-    def test_ObjectSpecification(self):        
+    def test_ObjectSpecification(self):
         c = C()
         directlyProvides(c, I4)
-        self.assertEqual([i.__name__ for i in providedBy(c)],
+        self.assertEqual([i.getName() for i in providedBy(c)],
                          ['I4', 'I31', 'I1', 'I2']
                          )
-        self.assertEqual([i.__name__ for i in providedBy(c).flattened()],
+        self.assertEqual([i.getName() for i in providedBy(c).flattened()],
                          ['I4', 'I31', 'I3', 'I1', 'I2', 'Interface']
                          )
         self.assert_(I1 in providedBy(c))
-        self.failIf(I3 in providedBy(c))        
+        self.failIf(I3 in providedBy(c))
         self.assert_(providedBy(c).extends(I3))
         self.assert_(providedBy(c).extends(I31))
         self.failIf(providedBy(c).extends(I5))
 
         class COnly(A, B):
             implementsOnly(I31)
-            
+
         class D(COnly):
             implements(I5)
-            
+
         classImplements(D, I5)
-        
+
         c = D()
         directlyProvides(c, I4)
-        self.assertEqual([i.__name__ for i in providedBy(c)],
+        self.assertEqual([i.getName() for i in providedBy(c)],
                          ['I4', 'I5', 'I31'])
-        self.assertEqual([i.__name__ for i in providedBy(c).flattened()],
+        self.assertEqual([i.getName() for i in providedBy(c).flattened()],
                          ['I4', 'I5', 'I31', 'I3', 'Interface'])
         self.failIf(I1 in providedBy(c))
         self.failIf(I3 in providedBy(c))
@@ -87,16 +87,16 @@
         self.assert_(providedBy(c).extends(I31))
         self.assert_(providedBy(c).extends(I5))
 
-        class COnly(A, B): __implements__ = I31        
+        class COnly(A, B): __implements__ = I31
         class D(COnly):
             implements(I5)
-            
+
         classImplements(D, I5)
         c = D()
         directlyProvides(c, I4)
-        self.assertEqual([i.__name__ for i in providedBy(c)],
+        self.assertEqual([i.getName() for i in providedBy(c)],
                          ['I4', 'I5', 'I31'])
-        self.assertEqual([i.__name__ for i in providedBy(c).flattened()],
+        self.assertEqual([i.getName() for i in providedBy(c).flattened()],
                          ['I4', 'I5', 'I31', 'I3', 'Interface'])
         self.failIf(I1 in providedBy(c))
         self.failIf(I3 in providedBy(c))
@@ -104,30 +104,30 @@
         self.failIf(providedBy(c).extends(I1))
         self.assert_(providedBy(c).extends(I31))
         self.assert_(providedBy(c).extends(I5))
-        
+
     def test_classImplements(self):
         class A(Odd):
           implements(I3)
-          
+
         class B(Odd):
           implements(I4)
-          
+
         class C(A, B):
           pass
         classImplements(C, I1, I2)
-        self.assertEqual([i.__name__ for i in implementedBy(C)],
+        self.assertEqual([i.getName() for i in implementedBy(C)],
                          ['I1', 'I2', 'I3', 'I4'])
         classImplements(C, I5)
-        self.assertEqual([i.__name__ for i in implementedBy(C)],
+        self.assertEqual([i.getName() for i in implementedBy(C)],
                          ['I1', 'I2', 'I5', 'I3', 'I4'])
-        
+
     def test_classImplementsOnly(self):
         class A(Odd):
             implements(I3)
-          
+
         class B(Odd):
             implements(I4)
-          
+
         class C(A, B):
           pass
         classImplementsOnly(C, I1, I2)
@@ -136,19 +136,19 @@
 
 
     def test_directlyProvides(self):
-        class IA1(Interface): pass        
+        class IA1(Interface): pass
         class IA2(Interface): pass
         class IB(Interface): pass
         class IC(Interface): pass
         class A(Odd):
             implements(IA1, IA2)
-            
+
         class B(Odd):
             implements(IB)
-            
+
         class C(A, B):
             implements(IC)
-            
+
 
         ob = C()
         directlyProvides(ob, I1, I2)
@@ -158,7 +158,7 @@
         self.assert_(IA2 in providedBy(ob))
         self.assert_(IB in providedBy(ob))
         self.assert_(IC in providedBy(ob))
-        
+
         directlyProvides(ob, directlyProvidedBy(ob)-I2)
         self.assert_(I1 in providedBy(ob))
         self.failIf(I2 in providedBy(ob))
@@ -182,18 +182,18 @@
 
     def test_implementedBy(self):
         class I2(I1): pass
-        
+
         class C1(Odd):
           implements(I2)
-          
+
         class C2(C1):
           implements(I3)
-          
-        self.assertEqual([i.__name__ for i in implementedBy(C2)],
+
+        self.assertEqual([i.getName() for i in implementedBy(C2)],
                          ['I3', 'I2'])
 
-    
-        
+
+
 
 def test_suite():
     suite = unittest.TestSuite()




More information about the Zope3-Checkins mailing list