[Zope3-checkins] CVS: Zope3/src/zope/component/tests - components.py:1.5 factory.py:1.3 test_api.py:1.9 test_resources.py:1.7 test_service.py:1.3 test_skins.py:1.5 test_utilityservice.py:1.6 views.py:1.3
Steve Alexander
steve@cat-box.net
Fri, 6 Jun 2003 15:29:40 -0400
Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv7875/src/zope/component/tests
Modified Files:
components.py factory.py test_api.py test_resources.py
test_service.py test_skins.py test_utilityservice.py views.py
Log Message:
Changed old-style __implements__ to new-style implements()
Also, fixed up some incorrect formatting.
=== Zope3/src/zope/component/tests/components.py 1.4 => 1.5 ===
--- Zope3/src/zope/component/tests/components.py:1.4 Tue Feb 18 14:40:29 2003
+++ Zope3/src/zope/component/tests/components.py Fri Jun 6 15:29:08 2003
@@ -17,8 +17,7 @@
"""
__metaclass__ = type # All classes are new style when run with Python 2.2+
-from zope.interface import Interface
-from zope.interface import Attribute
+from zope.interface import Interface, Attribute, implements
class RecordingAdapter:
@@ -49,11 +48,12 @@
class IContent(Interface): pass
-class Content: __implements__ = IContent
+class Content:
+ implements(IContent)
class Comp:
__used_for__ = IContent
- __implements__ = IApp
+ implements(IApp)
def __init__(self, *args):
# Ignore arguments passed to constructor
=== Zope3/src/zope/component/tests/factory.py 1.2 => 1.3 ===
--- Zope3/src/zope/component/tests/factory.py:1.2 Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/factory.py Fri Jun 6 15:29:08 2003
@@ -16,26 +16,26 @@
$Id$
"""
from zope.component.interfaces import IFactory
-from zope.interface import Interface
+from zope.interface import Interface, implements, implementedBy
class IX(Interface):
"""the dummy interface which class X supposedly implements,
according to the factory"""
class X:
- __implements__=IX
+ implements(IX)
def __init__(self, *args, **kwargs):
self.args=args
self.kwargs=kwargs
class ClassFactoryWrapper:
- __implements__ = IFactory
+ implements(IFactory)
def __init__(self, klass):
self.__klass=klass
def __call__(self, *args, **kwargs):
return self.__klass(*args, **kwargs)
def getInterfaces(self):
- return getattr(self.__klass,'__implements__', None)
+ return implementedBy(self.__klass)
f=ClassFactoryWrapper(X)
=== Zope3/src/zope/component/tests/test_api.py 1.8 => 1.9 ===
--- Zope3/src/zope/component/tests/test_api.py:1.8 Wed May 21 16:30:06 2003
+++ Zope3/src/zope/component/tests/test_api.py Fri Jun 6 15:29:08 2003
@@ -20,23 +20,23 @@
from zope.component import getUtility, queryUtility
from zope.component.servicenames import Adapters
from zope.component.tests.request import Request
-from zope.interface import Interface
+from zope.interface import Interface, implements
class I1(Interface): pass
class I2(Interface): pass
class I3(Interface): pass
class Comp:
- __implements__ = I2
+ implements(I2)
def __init__(self, context, request=None): self.context = context
class Comp2:
- __implements__ = I3
+ implements(I3)
def __init__(self, context, request=None): self.context = context
comp = Comp(1)
class Ob:
- __implements__ = I1
+ implements(I1)
ob = Ob()
@@ -105,7 +105,7 @@
provideAdapter = adapterService.provideAdapter
getAdapter = adapterService.getAdapter
queryAdapter = adapterService.queryAdapter
-
+
ob = Conforming()
# If an object implements the interface you want to adapt to,
=== Zope3/src/zope/component/tests/test_resources.py 1.6 => 1.7 ===
--- Zope3/src/zope/component/tests/test_resources.py:1.6 Thu May 1 15:35:39 2003
+++ Zope3/src/zope/component/tests/test_resources.py Fri Jun 6 15:29:08 2003
@@ -23,7 +23,7 @@
from zope.component import getResource, queryResource
from zope.component.exceptions import ComponentLookupError
from zope.component.servicenames import Skins, Resources
-from zope.interface import Interface
+from zope.interface import Interface, implements
from zope.component.tests.request import Request
class Test(PlacelessSetup, unittest.TestCase):
@@ -32,7 +32,7 @@
class I2(Interface): pass
class C1:
def __init__(self, request): pass
- __implements__ = I2
+ implements(I2)
class C2(C1): pass
getService(None,Resources).provideResource('test', I2, C1)
@@ -52,7 +52,7 @@
class C1:
def __init__(self, request): pass
- __implements__ = I2
+ implements(I2)
class C2(C1): pass
=== Zope3/src/zope/component/tests/test_service.py 1.2 => 1.3 ===
--- Zope3/src/zope/component/tests/test_service.py:1.2 Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/test_service.py Fri Jun 6 15:29:08 2003
@@ -17,7 +17,7 @@
"""
import unittest
-from zope.interface import Interface
+from zope.interface import Interface, implements
from zope.exceptions import DuplicationError
from zope.testing.cleanup import CleanUp
@@ -37,10 +37,10 @@
pass
class ServiceOne:
- __implements__ = IOne
+ implements(IOne)
class ServiceTwo:
- __implements__ = ITwo
+ implements(ITwo)
class Test(CleanUp, unittest.TestCase):
=== Zope3/src/zope/component/tests/test_skins.py 1.4 => 1.5 ===
--- Zope3/src/zope/component/tests/test_skins.py:1.4 Thu May 1 15:35:39 2003
+++ Zope3/src/zope/component/tests/test_skins.py Fri Jun 6 15:29:08 2003
@@ -17,7 +17,7 @@
from zope.component import getView, getService, queryView
from zope.component.exceptions import ComponentLookupError
from zope.component.servicenames import Skins
-from zope.interface import Interface
+from zope.interface import Interface, implements
from zope.component.tests.request import Request
@@ -28,13 +28,14 @@
class I2(Interface): pass
class C1:
- __implements__ = I2
+ implements(I2)
__used_for__ = I1
def __init__(self, o, request): self._context=o
class C2(C1): pass
class C3(C1): pass
- class O: __implements__ = I1
+ class O:
+ implements(I1)
getService(None, 'Views').provideView(I1, 'test', I2, [C1])
self.assertEqual(getView(O(), 'test', Request(I2)).__class__, C1)
@@ -61,13 +62,14 @@
class I2(Interface): pass
class C1:
- __implements__ = I2
+ implements(I2)
__used_for__ = I1
def __init__(self, o, request): self._context=o
class C2(C1): pass
class C3(C1): pass
- class O: __implements__ = I1
+ class O:
+ implements(I1)
getService(None, 'Views').provideView(I1, 'test', I2, [C1])
@@ -97,7 +99,6 @@
self.assertEqual(queryView(O(), 'test2',
Request(I2, 'foo'), None), None)
-
def test_suite():
=== Zope3/src/zope/component/tests/test_utilityservice.py 1.5 => 1.6 ===
--- Zope3/src/zope/component/tests/test_utilityservice.py:1.5 Thu May 1 15:35:39 2003
+++ Zope3/src/zope/component/tests/test_utilityservice.py Fri Jun 6 15:29:08 2003
@@ -23,7 +23,7 @@
getUtility, getService, queryUtility, getServiceManager
from zope.component.exceptions import ComponentLookupError
from zope.component.servicenames import Utilities
-from zope.interface import Interface
+from zope.interface import Interface, implements
from zope.testing.cleanup import CleanUp # Base class w registry cleanup
@@ -31,7 +31,7 @@
pass
class DummyService:
- __implements__ = IDummyService
+ implements(IDummyService)
dummyService = DummyService()
=== Zope3/src/zope/component/tests/views.py 1.2 => 1.3 ===
--- Zope3/src/zope/component/tests/views.py:1.2 Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/views.py Fri Jun 6 15:29:08 2003
@@ -16,7 +16,7 @@
Revision information: $Id$
"""
-from zope.interface import Interface
+from zope.interface import Interface, implements
class IV(Interface):
@@ -25,7 +25,7 @@
class IC(Interface): pass
class V1:
- __implements__ = IV
+ implements(IV)
def __init__(self,context, request):
self.context = context
@@ -47,7 +47,7 @@
def __init__(self, request):
pass
- __implements__ = IV
+ implements(IV)
class RZMI(R1):
pass