[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_dtmlpage.py:1.4.26.1 test_sqlscript.py:1.10.16.1 test_xmldocument.py:1.4.10.1 test_zptpage.py:1.10.12.1

Grégoire Weber zope@i-con.ch
Sun, 22 Jun 2003 10:23:58 -0400


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

Modified Files:
      Tag: cw-mail-branch
	test_dtmlpage.py test_sqlscript.py test_xmldocument.py 
	test_zptpage.py 
Log Message:
Synced up with HEAD

=== Zope3/src/zope/app/content/tests/test_dtmlpage.py 1.4 => 1.4.26.1 ===
--- Zope3/src/zope/app/content/tests/test_dtmlpage.py:1.4	Sat Dec 28 12:49:25 2002
+++ Zope3/src/zope/app/content/tests/test_dtmlpage.py	Sun Jun 22 10:22:57 2003
@@ -26,7 +26,7 @@
 from zope.app.traversing.adapters import Traverser, DefaultTraversable
 from zope.app.interfaces.traversing import ITraverser, ITraversable
 from zope.component.adapter import provideAdapter
-from zope.proxy.context import Wrapper
+from zope.context import Wrapper
 from zope.security.checker import NamesChecker, defineChecker
 
 


=== Zope3/src/zope/app/content/tests/test_sqlscript.py 1.10 => 1.10.16.1 ===
--- 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	Sun Jun 22 10:22:57 2003
@@ -17,6 +17,8 @@
 
 import unittest
 
+from zope.interface import implements, classImplements
+
 from zope.app.interfaces.rdb import IConnectionService
 from zope.app.interfaces.rdb import IZopeConnection
 from zope.app.interfaces.rdb import IZopeCursor
@@ -47,7 +49,7 @@
 
 class CursorStub:
 
-    __implements__ = IZopeCursor
+    implements(IZopeCursor)
 
     description = (('name', 'string'), ('counter', 'int'))
     count = 0
@@ -67,14 +69,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 +104,7 @@
 
 class CachingServiceStub:
 
-    __implements__ = ICachingService, ISimpleService
+    implements(ICachingService, ISimpleService)
 
     def __init__(self):
         self.caches = {}
@@ -112,7 +114,7 @@
 
 class LocatableStub:
 
-    __implements__ = IPhysicallyLocatable
+    implements(IPhysicallyLocatable)
 
     def __init__(self, obj):
         self.obj = obj
@@ -128,6 +130,7 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
+        classImplements(SQLScript, IAttributeAnnotatable)
         sm.defineService('SQLDatabaseConnections', IConnectionService)
         sm.provideService('SQLDatabaseConnections', ConnectionServiceStub())
         self._old_getNextServiceManager = nextservice.getNextServiceManager
@@ -179,14 +182,11 @@
         self.assertEqual(expected,
                          self._getScript().getSource())
 
-    def testSetConnectionName(self):
+    def testConnectionName(self):
         script = self._getScript()
-        script.setConnectionName('test_conn')
-        self.assertEqual('test_conn', script.getConnectionName())
-
-    def testGetConnectionName(self):
-        self.assertEqual('my_connection',
-                         self._getScript().getConnectionName())
+        self.assertEqual('my_connection', script.connectionName)
+        script.connectionName = 'test_conn'
+        self.assertEqual('test_conn', script.connectionName)
 
     def testSQLScript(self):
         result = self._getScript()(id=1)


=== Zope3/src/zope/app/content/tests/test_xmldocument.py 1.4 => 1.4.10.1 ===
--- 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	Sun Jun 22 10:22:57 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)


=== Zope3/src/zope/app/content/tests/test_zptpage.py 1.10 => 1.10.12.1 ===
--- Zope3/src/zope/app/content/tests/test_zptpage.py:1.10	Fri Apr 18 14:45:02 2003
+++ Zope3/src/zope/app/content/tests/test_zptpage.py	Sun Jun 22 10:22:57 2003
@@ -37,7 +37,8 @@
 from zope.app.interfaces.traversing import ITraverser
 from zope.app.interfaces.traversing import ITraversable
 from zope.component.adapter import provideAdapter
-from zope.proxy.context import Wrapper, ContextWrapper, getInnerWrapperData
+from zope.app.context import ContextWrapper
+from zope.context import Wrapper, getInnerWrapperData
 from zope.security.checker import NamesChecker, defineChecker
 
 class Data(object):