[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_sqlscript.py:1.11 test_xmldocument.py:1.5

Steve Alexander steve@cat-box.net
Sat, 7 Jun 2003 02:37:54 -0400


Update of /cvs-repository/Zope3/src/zope/app/content/tests
In directory cvs.zope.org:/tmp/cvs-serv4294/src/zope/app/content/tests

Modified Files:
	test_sqlscript.py test_xmldocument.py 
Log Message:
updated to use new-style interface declarations


=== Zope3/src/zope/app/content/tests/test_sqlscript.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/content/tests/test_sqlscript.py:1.10	Wed Mar 19 14:57:26 2003
+++ Zope3/src/zope/app/content/tests/test_sqlscript.py	Sat Jun  7 02:37:24 2003
@@ -39,6 +39,7 @@
 from zope.app.cache.annotationcacheable import AnnotationCacheable
 from zope.app.interfaces.traversing import IPhysicallyLocatable
 from zope.app.interfaces.services.service import ISimpleService
+from zope.interface import implements
 
 
 # Make spme fixes, so that we overcome some of the natural ZODB properties
@@ -47,7 +48,7 @@
 
 class CursorStub:
 
-    __implements__ = IZopeCursor
+    implements(IZopeCursor)
 
     description = (('name', 'string'), ('counter', 'int'))
     count = 0
@@ -67,14 +68,14 @@
 
 
 class ConnectionStub:
-    __implements__ = IZopeConnection
+    implements(IZopeConnection)
 
     def cursor(self):
         return CursorStub()
 
 
 class ConnectionServiceStub:
-    __implements__ = IConnectionService, ISimpleService
+    implements(IConnectionService, ISimpleService)
 
     def getConnection(self, name):
         return ConnectionStub()
@@ -102,7 +103,7 @@
 
 class CachingServiceStub:
 
-    __implements__ = ICachingService, ISimpleService
+    implements(ICachingService, ISimpleService)
 
     def __init__(self):
         self.caches = {}
@@ -112,7 +113,7 @@
 
 class LocatableStub:
 
-    __implements__ = IPhysicallyLocatable
+    implements(IPhysicallyLocatable)
 
     def __init__(self, obj):
         self.obj = obj


=== Zope3/src/zope/app/content/tests/test_xmldocument.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/content/tests/test_xmldocument.py:1.4	Thu May  1 15:35:11 2003
+++ Zope3/src/zope/app/content/tests/test_xmldocument.py	Sat Jun  7 02:37:24 2003
@@ -23,7 +23,7 @@
 from zope.app.interfaces.content.xmldocument import IXMLDocument
 from zope.app.tests.placelesssetup import PlacelessSetup
 
-from zope.interface import Interface
+from zope.interface import Interface, implements
 from zope.interface.interface import InterfaceClass
 from zope.app.interfaces.xml.source import IXMLSource
 from zope.app.component.globalinterfaceservice import interfaceService
@@ -32,18 +32,18 @@
     pass
 
 class XMLDocument2(XMLDocument):
-    __implements__ = IXMLDocument, IRandomInterface
+    implements(IXMLDocument, IRandomInterface)
+
 
-    
 class XMLDocumentTests(PlacelessSetup, unittest.TestCase):
 
     def test_create(self):
         doc = XMLDocument()
         self.assertEquals('<doc/>', doc.source)
-        
+
         doc = XMLDocument('<mydoc/>')
         self.assertEquals('<mydoc/>', doc.source)
-    
+
     def test_set(self):
         src = '<mydoc/>'
         doc = XMLDocument(src)
@@ -61,7 +61,7 @@
         extends = (IXMLSource,)
         interface1 = InterfaceClass(schema1, extends, {})
         interface2 = InterfaceClass(schema2, extends, {})
-        
+
         interfaceService.provideInterface(schema1, interface1)
 
         xml = '''
@@ -74,7 +74,7 @@
         self.assert_(interface1.isImplementedBy(doc))
         self.assert_(not interface2.isImplementedBy(doc))
         self.assert_(IXMLDocument.isImplementedBy(doc))
-        
+
         doc.source = '<doc />'
 
         self.assert_(not interface1.isImplementedBy(doc))
@@ -88,7 +88,7 @@
 foo
 </doc>'''
         doc.source = xml
-        
+
         self.assert_(interface1.isImplementedBy(doc))
         # can't find it as it isn't provided yet
         self.assert_(not interface2.isImplementedBy(doc))
@@ -98,24 +98,24 @@
         interfaceService.provideInterface(schema2, interface2)
 
         doc.source = xml
-        
+
         self.assert_(interface1.isImplementedBy(doc))
         self.assert_(interface2.isImplementedBy(doc))
         self.assert_(IXMLDocument.isImplementedBy(doc))
 
     def test_xmlschema_interfaces2(self):
         # the same tests, but XMLDocument2 has two interfaces not just one
-        
+
         doc = XMLDocument2()
         self.assert_(IXMLDocument.isImplementedBy(doc))
         self.assert_(IRandomInterface.isImplementedBy(doc))
-        
+
         schema1 = 'http://schema.zope.org/hypothetical/schema1'
         schema2 = 'http://schema.zope.org/hypothetical/schema2'
         extends = (IXMLSource,)
         interface1 = InterfaceClass(schema1, extends, {})
         interface2 = InterfaceClass(schema2, extends, {})
-        
+
         interfaceService.provideInterface(schema1, interface1)
 
         xml = '''
@@ -136,7 +136,7 @@
         self.assert_(not interface2.isImplementedBy(doc))
         self.assert_(IXMLDocument.isImplementedBy(doc))
         self.assert_(IRandomInterface.isImplementedBy(doc))
-        
+
         xml = '''
 <doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://schema.zope.org/hypothetical/schema1
@@ -144,22 +144,22 @@
 foo
 </doc>'''
         doc.source = xml
-        
+
         self.assert_(interface1.isImplementedBy(doc))
         # can't find it as it isn't provided yet
         self.assert_(not interface2.isImplementedBy(doc))
         self.assert_(IXMLDocument.isImplementedBy(doc))
         self.assert_(IRandomInterface.isImplementedBy(doc))
-        
+
         # finally provide and set document again
         interfaceService.provideInterface(schema2, interface2)
 
         doc.source = xml
-        
+
         self.assert_(interface1.isImplementedBy(doc))
         self.assert_(interface2.isImplementedBy(doc))
         self.assert_(IXMLDocument.isImplementedBy(doc))
         self.assert_(IRandomInterface.isImplementedBy(doc))
-        
+
 def test_suite():
     return unittest.makeSuite(XMLDocumentTests)