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

Sidnei da Silva sidnei at x3ng.com.br
Wed Aug 13 10:36:59 EDT 2003


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

Modified Files:
      Tag: dreamcatcher-ttwschema-branch
	test_declarations.py test_odd_declarations.py 
Log Message:
__name__-geddon. Use getName for getting the name of interfaces

=== Zope3/src/zope/interface/tests/test_declarations.py 1.7 => 1.7.20.1 ===
--- 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	Wed Aug 13 09:36:53 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.3.26.1 ===
--- 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	Wed Aug 13 09:36:53 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