[Zope3-checkins] CVS: Zope3/src/zope/component/tests - components.py:1.1.2.2 factory.py:1.1.2.2 placelesssetup.py:1.1.2.3 request.py:1.1.2.3 test_api.py:1.1.2.2 test_providefactory.py:1.1.2.3 test_resources.py:1.1.2.2 test_skins.py:1.1.2.2 test_utilityservice.py:1.1.2.3 views.py:1.1.2.2
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:32 -0500
Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/component/tests
Modified Files:
Tag: NameGeddon-branch
components.py factory.py placelesssetup.py request.py
test_api.py test_providefactory.py test_resources.py
test_skins.py test_utilityservice.py views.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/component/tests/components.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/tests/components.py:1.1.2.1 Mon Dec 23 15:20:04 2002
+++ Zope3/src/zope/component/tests/components.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -36,4 +36,3 @@
def f(): pass
comp = Comp()
-
=== Zope3/src/zope/component/tests/factory.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/tests/factory.py:1.1.2.1 Mon Dec 23 15:20:04 2002
+++ Zope3/src/zope/component/tests/factory.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -38,4 +38,4 @@
def getInterfaces(self):
return getattr(self.__klass,'__implements__', None)
-f=ClassFactoryWrapper(X)
\ No newline at end of file
+f=ClassFactoryWrapper(X)
=== Zope3/src/zope/component/tests/placelesssetup.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/component/tests/placelesssetup.py:1.1.2.2 Mon Dec 23 15:18:03 2002
+++ Zope3/src/zope/component/tests/placelesssetup.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
=== Zope3/src/zope/component/tests/request.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/component/tests/request.py:1.1.2.2 Tue Dec 24 07:51:25 2002
+++ Zope3/src/zope/component/tests/request.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -29,6 +29,5 @@
def getPresentationType(self):
'''See interface IPresentationRequest'''
-
- return self._iface
+ return self._iface
=== Zope3/src/zope/component/tests/test_api.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/tests/test_api.py:1.1.2.1 Mon Dec 23 14:32:41 2002
+++ Zope3/src/zope/component/tests/test_api.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
import unittest, sys
from zope.interface import Interface
@@ -61,14 +61,14 @@
# if an object implements the interface you want to adapt to,
# getAdapter should simply return the object
self.assertEquals(getAdapter(ob, I1), ob)
-
+
# if an adapter isn't registered for the given object and interface,
# and you provide no default, raise ComponentLookupError...
self.assertRaises(ComponentLookupError, getAdapter, ob, I2)
-
+
# ...otherwise, you get the default
self.assertEquals(queryAdapter(ob, I2, Test), Test)
-
+
getService(None, 'Adapters').provideAdapter(I1, I2, Comp)
c = getAdapter(ob, I2)
self.assertEquals(c.__class__, Comp)
@@ -77,7 +77,7 @@
def testNamedAdapter(self):
self.testAdapter()
-
+
from zope.component \
import getAdapter, getService, queryAdapter
from zope.component.exceptions import ComponentLookupError
@@ -86,16 +86,16 @@
# getAdapter should simply return the object UNLESS we are sking for a
# names adapter.
self.assertRaises(ComponentLookupError, getAdapter, ob, I1, 'test')
-
+
# if an adapter isn't registered for the given object and interface,
# and you provide no default, raise ComponentLookupError...
self.assertRaises(ComponentLookupError, getAdapter, ob, I2, 'test')
-
+
# ...otherwise, you get the default
self.assertEquals(queryAdapter(ob, I2, Test, name='test'), Test)
class Comp2(Comp): pass
-
+
getService(None, 'Adapters').provideAdapter(I1, I2, Comp2, name='test')
c = getAdapter(ob, I2, name='test')
self.assertEquals(c.__class__, Comp2)
@@ -113,7 +113,7 @@
def testAdapterForInterfaceNone(self):
from zope.component import getAdapter, getService
-
+
# providing an adapter for None says that your adapter can
# adapt anything to I2.
getService(None, 'Adapters').provideAdapter(None, I2, Comp)
@@ -129,7 +129,7 @@
self.assertRaises(ComponentLookupError, getUtility, ob, I1)
self.assertRaises(ComponentLookupError, getUtility, ob, I2)
self.assertEquals(queryUtility(ob, I2, Test), Test)
-
+
getService(None, 'Utilities').provideUtility(I2, comp)
self.assertEquals(id(getUtility(ob, I2)), id(comp))
@@ -143,7 +143,7 @@
self.assertRaises(ComponentLookupError, getUtility, ob, I1, 'test')
self.assertRaises(ComponentLookupError, getUtility, ob, I2, 'test')
self.assertEquals(queryUtility(ob, I2, Test, 'test'), Test)
-
+
getService(None, 'Utilities').provideUtility(I2, comp, 'test')
self.assertEquals(id(getUtility(ob, I2, 'test')), id(comp))
@@ -156,7 +156,7 @@
self.assertRaises(ComponentLookupError,
getView, ob, 'foo', Request(I2))
self.assertEquals(queryView(ob, 'foo', Request(I2), Test), Test)
-
+
getService(None, 'Views').provideView(I1, 'foo', I2, [Comp])
c = getView(ob, 'foo', Request(I2))
self.assertEquals(c.__class__, Comp)
@@ -168,7 +168,7 @@
getView, ob, 'foo2', Request(I2))
self.assertEquals(queryView(ob, 'foo2', Request(I2), Test), Test)
- self.assertEquals(queryView( ob, 'foo2', Request(I1), None), None)
+ self.assertEquals(queryView( ob, 'foo2', Request(I1), None), None)
def testDefaultViewName(self):
from zope.component import getService
@@ -190,13 +190,13 @@
# The following tests are copied from
# Interface.Registry.tests.IAdapterRegistry
-
+
def __registery(self):
from zope.component.adapter \
import GlobalAdapterService
-
+
registry = GlobalAdapterService()
-
+
registry.provideAdapter(None, P3, [default_P3])
registry.provideAdapter(Interface, P3, [any_P3])
@@ -207,7 +207,7 @@
def test_getRegisteredMatching_all(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching())
got.sort()
expect = [
@@ -220,7 +220,7 @@
def test_getRegisteredMatching_for_R1(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching(
for_interfaces = (R1, )
))
@@ -234,7 +234,7 @@
def test_getRegisteredMatching_for_multiple(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching(
for_interfaces = (R12, R2)
))
@@ -249,7 +249,7 @@
def test_getRegisteredMatching_provided_P1(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching(
provided_interfaces = (P1, )
))
@@ -264,7 +264,7 @@
def test_getRegisteredMatching_provided_P2(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching(
provided_interfaces = (P3, )
))
@@ -279,7 +279,7 @@
def test_getRegisteredMatching_for_and_provided_1(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching(
for_interfaces = (R4, R12),
provided_interfaces = (P1, ),
@@ -295,7 +295,7 @@
def test_getRegisteredMatching_for_and_provided_2(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching(
for_interfaces = (R4, R12),
provided_interfaces = (P3, ),
@@ -308,11 +308,11 @@
]
expect.sort()
self.assertEqual(got, expect)
-
+
def test_getRegisteredMatching_for_and_provided_exact(self):
registry = self.__registery()
-
+
got = list(registry.getRegisteredMatching(
for_interfaces = (R2, ),
provided_interfaces = (P3, ),
@@ -328,7 +328,7 @@
-
+
def test_suite():
loader = unittest.TestLoader()
=== Zope3/src/zope/component/tests/test_providefactory.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/component/tests/test_providefactory.py:1.1.2.2 Mon Dec 23 15:18:03 2002
+++ Zope3/src/zope/component/tests/test_providefactory.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Test the provideFactory method.
=== Zope3/src/zope/component/tests/test_resources.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/tests/test_resources.py:1.1.2.1 Mon Dec 23 14:32:41 2002
+++ Zope3/src/zope/component/tests/test_resources.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -21,7 +21,7 @@
from zope.component import getService
from zope.component.tests.placelesssetup import PlacelessSetup
from zope.component import getResource, queryResource
-from zope.component.exceptions import ComponentLookupError
+from zope.component.exceptions import ComponentLookupError
from zope.interface import Interface
from zope.component.tests.request import Request
@@ -35,16 +35,16 @@
class C2(C1): pass
getService(None,'Resources').provideResource('test', I2, C1)
- self.assertEqual(getResource(None, 'test', Request(I2)).__class__, C1)
+ self.assertEqual(getResource(None, 'test', Request(I2)).__class__, C1)
getService(None,'Skins').defineSkin('foo', I2, ('foo', 'default'))
self.assertEqual(
getResource(None, 'test', Request(I2, 'foo')).__class__,
- C1)
+ C1)
getService(None,'Resources').provideResource('test', I2, C2,
layer='foo')
self.assertEqual(
getResource(None, 'test', Request(I2, 'foo')).__class__,
- C2)
+ C2)
def testGetRequestResourceMethod(self):
class I2(Interface): pass
@@ -53,12 +53,12 @@
__implements__ = I2
class C2(C1): pass
-
+
getService(None,'Resources').provideResource('test', I2, C1)
self.assertEqual(
getResource(None, 'test', Request(I2, 'default') ).__class__,
- C1)
+ C1)
getService(None,'Skins').defineSkin('foo', I2, ('foo', 'default'))
self.assertEqual(
getResource(None, 'test', Request(I2, 'foo')).__class__,
@@ -70,7 +70,7 @@
C2)
self.assertRaises(
- ComponentLookupError,
+ ComponentLookupError,
getResource, None, 'test2', Request(I2, 'foo'))
self.assertEqual(
=== Zope3/src/zope/component/tests/test_skins.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/tests/test_skins.py:1.1.2.1 Mon Dec 23 14:32:41 2002
+++ Zope3/src/zope/component/tests/test_skins.py Tue Dec 24 21:20:57 2002
@@ -2,20 +2,20 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
import unittest, sys
from zope.component.tests.placelesssetup import PlacelessSetup
from zope.component import getView, getService, queryView
-from zope.component.exceptions import ComponentLookupError
+from zope.component.exceptions import ComponentLookupError
from zope.interface import Interface
from zope.component.tests.request import Request
@@ -36,21 +36,21 @@
class O: __implements__ = I1
getService(None, 'Views').provideView(I1, 'test', I2, [C1])
- self.assertEqual(getView(O(), 'test', Request(I2)).__class__, C1)
+ self.assertEqual(getView(O(), 'test', Request(I2)).__class__, C1)
getService(None, 'Skins').defineSkin('foo', I2, ('foo', 'default'))
self.assertEqual(getView(O(), 'test', Request(I2, 'foo')).__class__,
- C1)
+ C1)
getService(None, 'Views').provideView(None, 'test', I2, [C2])
self.assertEqual(getView(O(), 'test', Request(I2, 'foo')).__class__,
- C1)
+ C1)
getService(None, 'Views').provideView(
None, 'test', I2, [C2], layer='foo')
self.assertEqual(getView(O(), 'test', Request(I2, 'foo')).__class__,
- C2)
+ C2)
getService(None, 'Views').provideView(
I1, 'test', I2, [C3], layer='foo')
self.assertEqual(getView(O(), 'test', Request(I2, 'foo')).__class__,
- C3)
+ C3)
@@ -70,34 +70,34 @@
getService(None, 'Views').provideView(I1, 'test', I2, [C1])
- self.assertEqual(getView(O(), 'test',
- Request(I2,'') ).__class__, C1)
+ self.assertEqual(getView(O(), 'test',
+ Request(I2,'') ).__class__, C1)
getService(None, 'Skins').defineSkin('foo', I2, ('foo', 'default'))
- self.assertEqual(getView(O(), 'test',
- Request(I2, 'foo')).__class__, C1)
+ self.assertEqual(getView(O(), 'test',
+ Request(I2, 'foo')).__class__, C1)
getService(None, 'Views').provideView(None, 'test', I2, [C2])
- self.assertEqual(getView(O(), 'test',
- Request(I2, 'foo')).__class__, C1)
+ self.assertEqual(getView(O(), 'test',
+ Request(I2, 'foo')).__class__, C1)
getService(None, 'Views').provideView(
None, 'test', I2, [C2], layer='foo')
- self.assertEqual(getView(O(), 'test',
- Request(I2, 'foo')).__class__, C2)
+ self.assertEqual(getView(O(), 'test',
+ Request(I2, 'foo')).__class__, C2)
getService(None, 'Views').provideView(
I1, 'test', I2, [C3], layer='foo')
- self.assertEqual(getView(O(), 'test',
- Request(I2, 'foo')).__class__, C3)
+ self.assertEqual(getView(O(), 'test',
+ Request(I2, 'foo')).__class__, C3)
- self.assertRaises(ComponentLookupError,
+ self.assertRaises(ComponentLookupError,
getView, O(), 'test2', Request(I2, 'foo'))
- self.assertEqual(queryView(O(), 'test2',
- Request(I2, 'foo'), None), None)
+ self.assertEqual(queryView(O(), 'test2',
+ Request(I2, 'foo'), None), None)
+
-
def test_suite():
loader=unittest.TestLoader()
=== Zope3/src/zope/component/tests/test_utilityservice.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/component/tests/test_utilityservice.py:1.1.2.2 Mon Dec 23 15:18:03 2002
+++ Zope3/src/zope/component/tests/test_utilityservice.py Tue Dec 24 21:20:57 2002
@@ -21,7 +21,7 @@
from unittest import TestCase, TestSuite, main, makeSuite
from zope.component import \
getUtility, getService, queryUtility, getServiceManager
-from zope.component.exceptions import ComponentLookupError
+from zope.component.exceptions import ComponentLookupError
from zope.interface import Interface
from zope.testing.cleanup import CleanUp # Base class w registry cleanup
@@ -44,21 +44,21 @@
defineService('Utilities',IUtilityService)
from zope.component.utility import utilityService
provideService('Utilities', utilityService)
-
+
def testGetUtility(self):
us = getService(None, "Utilities")
self.assertRaises(
ComponentLookupError, getUtility, None, IDummyService)
us.provideUtility(IDummyService, dummyService)
self.assertEqual(getUtility(None, IDummyService), dummyService)
-
+
def testQueryUtility(self):
us = getService(None, "Utilities")
self.assertEqual(queryUtility(None, IDummyService), None)
self.assertEqual(queryUtility(None, IDummyService, self), self)
us.provideUtility(IDummyService, dummyService)
self.assertEqual(queryUtility(None, IDummyService), dummyService)
-
+
def test_suite():
return makeSuite(Test)
=== Zope3/src/zope/component/tests/views.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/component/tests/views.py:1.1.2.1 Mon Dec 23 15:20:04 2002
+++ Zope3/src/zope/component/tests/views.py Tue Dec 24 21:20:57 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -21,13 +21,13 @@
class IV(Interface):
def index(): pass
-
+
class IC(Interface): pass
class V1:
__implements__ = IV
- def __init__(self,context, request):
+ def __init__(self,context, request):
self.context = context
self.request = request
@@ -44,11 +44,10 @@
def action(self): return 'R done'
- def __init__(self, request):
- pass
+ def __init__(self, request):
+ pass
__implements__ = IV
class RZMI(R1):
pass
-