[Zope3-checkins] CVS: Zope3/src/zope/app/component/tests - placelesssetup.py:1.1.2.2 service.py:1.1.2.2 test_directives.py:1.1.2.4 test_interfacefield.py:1.1.2.3 test_interfaceservice.py:1.1.2.2 test_nextservice.py:1.1.2.2 test_servicedirective.py:1.1.2.4 test_servicemanagercontainer.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:23 -0500
Update of /cvs-repository/Zope3/src/zope/app/component/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/component/tests
Modified Files:
Tag: NameGeddon-branch
placelesssetup.py service.py test_directives.py
test_interfacefield.py test_interfaceservice.py
test_nextservice.py test_servicedirective.py
test_servicemanagercontainer.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/app/component/tests/placelesssetup.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/tests/placelesssetup.py:1.1.2.1 Mon Dec 23 14:31:27 2002
+++ Zope3/src/zope/app/component/tests/placelesssetup.py Tue Dec 24 21:20:22 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.
-#
+#
##############################################################################
"""Unit test logic for setting up and tearing down basic infrastructure
=== Zope3/src/zope/app/component/tests/service.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/tests/service.py:1.1.2.1 Mon Dec 23 17:22:36 2002
+++ Zope3/src/zope/app/component/tests/service.py Tue Dec 24 21:20:22 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.
-#
+#
##############################################################################
"""
@@ -30,7 +30,7 @@
def foo(self): return "foo here"
def foobar(self): return "foobarred"
-
+
def bar(self): return "you shouldn't get this"
fooService = FooService()
=== Zope3/src/zope/app/component/tests/test_directives.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/component/tests/test_directives.py:1.1.2.3 Tue Dec 24 07:50:58 2002
+++ Zope3/src/zope/app/component/tests/test_directives.py Tue Dec 24 21:20:22 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
@@ -60,7 +60,7 @@
# Full import is critical!
from zope.component.tests.components import Content, IApp, Comp
-
+
self.assertEqual(queryAdapter(Content(), IV, None), None)
xmlconfig(StringIO(template % (
@@ -71,17 +71,17 @@
for="zope.component.tests.components.IContent"
/>
"""
- )))
-
+ )))
+
self.assertEqual(getAdapter(Content(), IApp).__class__, Comp)
def testNamedAdapter(self):
-
+
from zope.component import getAdapter, queryAdapter
# Full import is critical!
from zope.component.tests.components import Content, IApp, Comp
-
+
self.testAdapter()
self.assertEqual(getAdapter(Content(), IApp).__class__, Comp)
self.assertEqual(queryAdapter(Content(), IV, None, name='test'),
@@ -96,8 +96,8 @@
name="test"
/>
"""
- )))
-
+ )))
+
self.assertEqual(getAdapter(Content(), IApp, name="test").__class__,
Comp)
@@ -106,7 +106,7 @@
# Full import is critical!
from zope.component.tests.components import Content, IApp, Comp
-
+
self.assertEqual(queryAdapter(Content(), IV, None), None)
xmlconfig(StringIO(template % (
@@ -118,8 +118,8 @@
permission="zope.Public"
/>
"""
- )))
-
+ )))
+
adapter = getAdapter(Content(), IApp)
items = [item[0] for item in getTestProxyItems(adapter)]
self.assertEqual(items, ['a', 'f'])
@@ -144,7 +144,7 @@
# Full import is critical!
from zope.component.tests.components import IApp, comp
-
+
self.assertEqual(queryUtility(None, IV, None), None)
xmlconfig(StringIO(template % (
@@ -154,8 +154,8 @@
provides="zope.component.tests.components.IApp"
/>
"""
- )))
-
+ )))
+
self.assertEqual(getUtility(None, IApp), comp)
def testNamedUtility(self):
@@ -165,7 +165,7 @@
from zope.component.tests.components import IApp, comp
self.testUtility()
-
+
self.assertEqual(queryUtility(None, IV, None, name='test'), None)
xmlconfig(StringIO(template % (
@@ -176,8 +176,8 @@
name="test"
/>
"""
- )))
-
+ )))
+
self.assertEqual(getUtility(None, IApp, "test"), comp)
def testUtilityFactory(self):
@@ -185,7 +185,7 @@
# Full import is critical!
from zope.component.tests.components import IApp, Comp
-
+
self.assertEqual(queryUtility(None, IV, None), None)
xmlconfig(StringIO(template % (
@@ -195,8 +195,8 @@
provides="zope.component.tests.components.IApp"
/>
"""
- )))
-
+ )))
+
self.assertEqual(getUtility(None, IApp).__class__, Comp)
def testProtectedUtility(self):
@@ -204,7 +204,7 @@
# Full import is critical!
from zope.component.tests.components import IApp, comp
-
+
self.assertEqual(queryUtility(None, IV, None), None)
xmlconfig(StringIO(template % (
@@ -215,13 +215,13 @@
permission="zope.Public"
/>
"""
- )))
-
+ )))
+
utility = getUtility(None, IApp)
items = [item[0] for item in getTestProxyItems(utility)]
self.assertEqual(items, ['a', 'f'])
self.assertEqual(proxiedObject(utility), comp)
-
+
def testUtilityUndefinedPermission(self):
config = StringIO(template % (
"""
@@ -245,11 +245,11 @@
"""
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
- type="zope.component.tests.views.IV"/>
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
"""
))
-
+
self.assertEqual(queryView(ob, 'test', Request(IV), None).__class__,
V1)
@@ -258,11 +258,11 @@
"""
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
type="zope.component.tests.views.IV"
permission="zope.Public"
allowed_interface="zope.component.tests.views.IV"
- />
+ />
"""
))
@@ -275,11 +275,11 @@
"""
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
type="zope.component.tests.views.IV"
permission="zope.Public"
allowed_attributes="action"
- />
+ />
"""
))
@@ -292,12 +292,12 @@
"""
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
type="zope.component.tests.views.IV"
permission="zope.Public"
allowed_attributes="action"
allowed_interface="zope.component.tests.views.IV"
- />
+ />
"""
))
@@ -310,12 +310,12 @@
"""
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
type="zope.component.tests.views.IV"
permission="zope.Public"
allowed_attributes="action index"
allowed_interface="zope.component.tests.views.IV"
- />
+ />
"""
))
@@ -331,10 +331,10 @@
"""
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
type="zope.component.tests.views.IV"
allowed_attributes="action index"
- />
+ />
"""
))
@@ -343,19 +343,19 @@
"""
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
type="zope.component.tests.views.IV"
permission="UndefinedPermission"
allowed_attributes="action index"
allowed_interface="zope.component.tests.views.IV"
- />
+ />
"""
))
self.assertRaises(UndefinedPermissionError, xmlconfig, config,
testing=1)
-
+
def testDefaultView(self):
ob = Ob()
@@ -365,15 +365,15 @@
"""
<defaultView name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
- type="zope.component.tests.views.IV"/>
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
"""
- )))
-
+ )))
+
self.assertEqual(queryView(ob, 'test', Request(IV), None).__class__,
V1)
self.assertEqual(getDefaultViewName(ob, Request(IV)), 'test')
-
+
def testDefaultViewOnly(self):
ob = Ob()
@@ -382,14 +382,14 @@
xmlconfig(StringIO(template % (
"""
<defaultView name="test"
- for="zope.component.tests.views.IC"
- type="zope.component.tests.views.IV"/>
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
"""
- )))
-
+ )))
+
self.assertEqual(queryView(ob, 'test', Request(IV), None), None)
self.assertEqual(getDefaultViewName(ob, Request(IV)), 'test')
-
+
def testSkinView(self):
ob = Ob()
@@ -401,16 +401,16 @@
type="zope.component.tests.views.IV" />
<view name="test"
factory="zope.component.tests.views.VZMI"
- layer="zmi"
- for="zope.component.tests.views.IC"
- type="zope.component.tests.views.IV"/>
+ layer="zmi"
+ for="zope.component.tests.views.IC"
+ type="zope.component.tests.views.IV"/>
<view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
type="zope.component.tests.views.IV"/>
"""
- )))
-
+ )))
+
self.assertEqual(queryView(ob, 'test', Request(IV), None).__class__,
V1)
self.assertEqual(
@@ -425,28 +425,28 @@
"""
<resource name="test"
factory="zope.component.tests.views.R1"
- type="zope.component.tests.views.IV"/>
+ type="zope.component.tests.views.IV"/>
"""
- )))
-
+ )))
+
self.assertEqual(queryResource(ob, 'test', Request(IV), None
).__class__,
R1)
-
+
def testResourceUndefinedPermission(self):
-
+
config = StringIO(template % (
"""
<resource name="test"
factory="zope.component.tests.views.R1"
type="zope.component.tests.views.IV"
- permission="UndefinedPermission"/>
+ permission="UndefinedPermission"/>
"""
))
self.assertRaises(UndefinedPermissionError, xmlconfig, config,
testing=1)
-
+
def testSkinResource(self):
ob = Ob()
@@ -458,14 +458,14 @@
type="zope.component.tests.views.IV" />
<resource name="test"
factory="zope.component.tests.views.RZMI"
- layer="zmi"
- type="zope.component.tests.views.IV"/>
+ layer="zmi"
+ type="zope.component.tests.views.IV"/>
<resource name="test"
factory="zope.component.tests.views.R1"
type="zope.component.tests.views.IV"/>
"""
- )))
-
+ )))
+
self.assertEqual(
queryResource(ob, 'test', Request(IV), None).__class__,
R1)
@@ -479,15 +479,15 @@
xmlconfig(StringIO(template % (
"""
- <factory
+ <factory
id="foo"
component="zope.component.tests.factory.f"
/>
- <factory
+ <factory
component="zope.component.tests.factory.f"
/>
"""
- )))
+ )))
from zope.component.tests.factory import X
self.assertEqual(createObject(None, 'foo').__class__, X)
@@ -501,4 +501,3 @@
return loader.loadTestsFromTestCase(Test)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())
-
=== Zope3/src/zope/app/component/tests/test_interfacefield.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/component/tests/test_interfacefield.py:1.1.2.2 Mon Dec 23 17:22:36 2002
+++ Zope3/src/zope/app/component/tests/test_interfacefield.py Tue Dec 24 21:20:22 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.
-#
+#
##############################################################################
"""Interface fields tests
@@ -21,16 +21,16 @@
import zope.interface as InterfaceModule
from zope.app.component.interfacefield import InterfaceField
from zope.schema.interfaces import ValidationError
-
+
class Test(TestCase):
def test_validate(self):
field = InterfaceField()
-
+
field.validate(Interface)
class I(Interface): pass
field.validate(I)
-
+
self.assertRaises(ValidationError, field.validate, InterfaceModule)
class I: pass
self.assertRaises(ValidationError, field.validate, I)
@@ -40,12 +40,12 @@
class I1(Interface): pass
class I2(I1): pass
class I3(I2): pass
-
+
field = InterfaceField(type=I2)
-
+
field.validate(I2)
field.validate(I3)
-
+
self.assertRaises(ValidationError, field.validate, Interface)
self.assertRaises(ValidationError, field.validate, I1)
@@ -54,4 +54,3 @@
if __name__=='__main__':
main(defaultTest='test_suite')
-
=== Zope3/src/zope/app/component/tests/test_interfaceservice.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/tests/test_interfaceservice.py:1.1.2.1 Mon Dec 23 14:31:27 2002
+++ Zope3/src/zope/app/component/tests/test_interfaceservice.py Tue Dec 24 21:20:22 2002
@@ -17,11 +17,11 @@
class I(Interface):
"""bah blah
"""
-
+
class I2(B):
"""eek
"""
-
+
class I3(B):
"""
"""
@@ -30,18 +30,18 @@
def two():
"""method two"""
-
+
class Test(CleanUp, TestCase):
"""Test Interface for InterfaceService Instance.
"""
-
+
def testInterfaceVerification(self):
-
+
verifyObject(IGlobalInterfaceService, InterfaceService())
def testInterfaceService(self):
service = InterfaceService()
-
+
self.assertRaises(ComponentLookupError,
service.getInterface, 'Foo.Bar')
self.assertEqual(service.queryInterface('Foo.Bar'), None)
@@ -81,11 +81,10 @@
if __name__=='__main__':
main(defaultTest='test_suite')
self.assertEqual(list(service.searchInterface('two')), [I3])
-
+
def test_suite():
return TestSuite((makeSuite(Test),))
if __name__=='__main__':
main(defaultTest='test_suite')
-
=== Zope3/src/zope/app/component/tests/test_nextservice.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/component/tests/test_nextservice.py:1.1.2.1 Mon Dec 23 14:31:27 2002
+++ Zope3/src/zope/app/component/tests/test_nextservice.py Tue Dec 24 21:20:22 2002
@@ -30,7 +30,7 @@
class ServiceManager:
__implements__ = IServiceService
-
+
class Folder:
__implements__ = IServiceManagerContainer
@@ -78,13 +78,10 @@
self.assertEqual(getNextServiceManager(Wrapper(sm1, f1)),
serviceManager)
self.assertEqual(getNextServiceManager(Wrapper(sm2, f2)), sm1)
-
+
def test_suite():
return makeSuite(Test)
if __name__=='__main__':
main(defaultTest='test_suite')
-
-
-
=== Zope3/src/zope/app/component/tests/test_servicedirective.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/component/tests/test_servicedirective.py:1.1.2.3 Tue Dec 24 07:50:58 2002
+++ Zope3/src/zope/app/component/tests/test_servicedirective.py Tue Dec 24 21:20:22 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
@@ -92,7 +92,7 @@
def testServiceConfig(self):
self.assertRaises(ComponentLookupError, getService, None, "Foo")
-
+
xmlconfig(StringIO(template % (
"""
<serviceType id="Foo"
@@ -114,7 +114,7 @@
def testServiceFactoryConfig(self):
self.assertRaises(ComponentLookupError, getService, None, "Foo")
-
+
xmlconfig(StringIO(template % (
"""
<serviceType id="Foo"
@@ -136,7 +136,7 @@
def testPublicProtectedServiceConfig(self):
self.assertRaises(ComponentLookupError, getService, None, "Foo")
-
+
xmlconfig(StringIO(template % (
"""
<serviceType id="Foo"
@@ -160,7 +160,7 @@
def testProtectedServiceConfig(self):
self.assertRaises(ComponentLookupError, getService, None, "Foo")
-
+
xmlconfig(StringIO(template % (
"""
<directives namespace="http://namespaces.zope.org/zope">
@@ -198,10 +198,9 @@
self.assertRaises(Forbidden, getattr, service, 'bar')
-
+
def test_suite():
loader=unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())
-
=== Zope3/src/zope/app/component/tests/test_servicemanagercontainer.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/component/tests/test_servicemanagercontainer.py:1.1.2.2 Tue Dec 24 07:50:58 2002
+++ Zope3/src/zope/app/component/tests/test_servicemanagercontainer.py Tue Dec 24 21:20:22 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.
-#
+#
##############################################################################
"""
@@ -57,7 +57,7 @@
def testIServiceManagerContainerVerify(self):
verifyObject(IServiceManagerContainer, self._Test__new())
-
+
def testHas(self):
smc=self._Test__new()
self.failIf(smc.hasServiceManager())