[Zope3-checkins] CVS: Zope3/src/zope/component/tests -
components.py:1.6 placelesssetup.py:1.10 test_adapter.py:1.6
test_api.py:1.20 test_factory.py:1.6 test_presentation.py:1.6
test_service.py:1.6 test_utilityservice.py:1.12
Steve Alexander
steve at cat-box.net
Tue Apr 20 07:01:23 EDT 2004
Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv4440/src/zope/component/tests
Modified Files:
components.py placelesssetup.py test_adapter.py test_api.py
test_factory.py test_presentation.py test_service.py
test_utilityservice.py
Log Message:
Whitespace cleaning in the CA.
=== Zope3/src/zope/component/tests/components.py 1.5 => 1.6 ===
--- Zope3/src/zope/component/tests/components.py:1.5 Fri Jun 6 15:29:08 2003
+++ Zope3/src/zope/component/tests/components.py Tue Apr 20 07:01:21 2004
@@ -59,7 +59,7 @@
# Ignore arguments passed to constructor
pass
- a=1
+ a = 1
def f(): pass
comp = Comp()
=== Zope3/src/zope/component/tests/placelesssetup.py 1.9 => 1.10 ===
--- Zope3/src/zope/component/tests/placelesssetup.py:1.9 Sun Apr 11 14:16:54 2004
+++ Zope3/src/zope/component/tests/placelesssetup.py Tue Apr 20 07:01:21 2004
@@ -41,7 +41,7 @@
defineService(Adapters, IAdapterService)
from zope.component.adapter import GlobalAdapterService
provideService(Adapters, GlobalAdapterService())
-
+
# presentation service
from zope.component.interfaces import IPresentationService
defineService(Presentation, IPresentationService)
=== Zope3/src/zope/component/tests/test_adapter.py 1.5 => 1.6 ===
--- Zope3/src/zope/component/tests/test_adapter.py:1.5 Thu Apr 15 09:26:21 2004
+++ Zope3/src/zope/component/tests/test_adapter.py Tue Apr 20 07:01:21 2004
@@ -21,7 +21,7 @@
from zope.component.adapter import GlobalAdapterService
class GlobalAdapterServiceTests(unittest.TestCase):
-
+
def test_pickling(self):
from zope.component.tests.test_service import testServiceManager
from zope.component.interfaces import IAdapterService
=== Zope3/src/zope/component/tests/test_api.py 1.19 => 1.20 ===
--- Zope3/src/zope/component/tests/test_api.py:1.19 Wed Mar 31 18:26:26 2004
+++ Zope3/src/zope/component/tests/test_api.py Tue Apr 20 07:01:21 2004
@@ -140,7 +140,6 @@
self.testAdapter()
-
# If an object implements the interface you want to adapt to,
# getAdapter should simply return the object UNLESS we are asking for a
# named adapter.
@@ -261,7 +260,7 @@
getService(None, servicenames.Presentation).provideView(
I1, 'foo', I2, Comp, providing=I3)
-
+
c = getView(ob, 'foo', Request(I2), providing=I3)
self.assertEquals(c.__class__, Comp)
self.assertEquals(c.context, ob)
@@ -302,33 +301,33 @@
# passes its arguments through to getView/queryView - here we hack
# getView and queryView to inspect the args passed through.
import zope.component
-
+
# hack zope.component.getView
def getView(object, name, request, context, providing):
self.args = [object, name, request, context, providing]
savedGetView = zope.component.getView
zope.component.getView = getView
-
+
# confirm pass through of args to getView by way of getViewProviding
zope.component.getViewProviding(
object='object', providing='providing', request='request',
context='context')
self.assertEquals(self.args,
['object', '', 'request', 'context', 'providing'])
-
+
# hack zope.component.queryView
def queryView(object, name, request, default, context, providing):
self.args = [object, name, request, default, context, providing]
savedQueryView = zope.component.queryView
zope.component.queryView = queryView
-
+
# confirm pass through of args to queryView by way of queryViewProviding
zope.component.queryViewProviding(
object='object', providing='providing', request='request',
default='default', context='context')
self.assertEquals(self.args,
['object', '', 'request', 'default', 'context', 'providing'])
-
+
# restore zope.component
zope.component.getView = savedGetView
zope.component.queryView = savedQueryView
@@ -384,7 +383,7 @@
getService(None, servicenames.Presentation).provideResource(
'foo', I2, Comp, providing=I3)
-
+
c = getResource(ob, 'foo', r2, providing=I3)
self.assertEquals(c.__class__, Comp)
self.assertEquals(c.context, r2)
@@ -441,7 +440,6 @@
def testNotBrokenWhenNoService(self):
self.assertRaises(TypeError, I2, ob)
self.assertEquals(I2(ob, 42), 42)
-
def test_suite():
=== Zope3/src/zope/component/tests/test_factory.py 1.5 => 1.6 ===
--- Zope3/src/zope/component/tests/test_factory.py:1.5 Sun Apr 11 14:16:56 2004
+++ Zope3/src/zope/component/tests/test_factory.py Tue Apr 20 07:01:21 2004
@@ -59,8 +59,8 @@
self.assertEqual(list(implemented), [IKlass])
implemented2 = self._factory2.getInterfaces()
self.assertEqual(list(implemented2), [])
-
-
+
+
class TestFactoryZAPIFunctions(PlacelessSetup, unittest.TestCase):
def setUp(self):
@@ -83,7 +83,7 @@
def testGetFactoriesFor(self):
self.assertEqual(list(getFactoriesFor(None, IKlass)),
[('klass', self.factory)])
-
+
def test_suite():
return unittest.TestSuite((
=== Zope3/src/zope/component/tests/test_presentation.py 1.5 => 1.6 ===
--- Zope3/src/zope/component/tests/test_presentation.py:1.5 Fri Apr 9 07:36:14 2004
+++ Zope3/src/zope/component/tests/test_presentation.py Tue Apr 20 07:01:21 2004
@@ -39,7 +39,6 @@
self.context, self.request = context, request
-
def test_view_lookup_fails_w_wrong_skin():
"""
>>> s = GlobalPresentationService()
@@ -91,7 +90,7 @@
>>> bob = Contact()
>>> acme = Company()
-
+
>>> v = s.queryMultiView((bob, acme), request, name='foo')
>>> v.__class__.__name__
'ContactInCompanyView'
@@ -105,7 +104,7 @@
>>> s.provideAdapter(IRequest, ContactInFamilyView,
... contexts=[IContact, IFamily], name='foo',
... info='test 2')
-
+
>>> smith = Family()
>>> v = s.queryMultiView((bob, smith), request, name='foo')
>>> v.__class__.__name__
@@ -129,7 +128,7 @@
zope.component.presentation.PresentationRegistration(""" \
"""default, ('IContact', 'IFamily', 'IRequest'), """ \
"""'Interface', 'foo', 'ContactInFamilyView', 'test 2')
-
+
"""
def test_provideView():
@@ -160,7 +159,7 @@
>>> c = Contact()
>>> request.skin = 'custom'
-
+
>>> v = s.queryView(c, 'foo', request)
>>> v.__class__.__name__
@@ -197,12 +196,12 @@
>>> s.defineLayer('custom')
>>> s.defineSkin('custom', ['custom', 'default'])
>>> s.setDefaultViewName(IContact, IRequest, 'hello.html', layer='custom')
-
+
If we don't specify the custum skin, we'll still get the default:
>>> s.queryDefaultViewName(c, request)
'index.html'
-
+
But if we specify a custom skin, we'll get the custom value for a contact:
>>> request.skin = 'custom'
@@ -210,10 +209,10 @@
'hello.html'
But not for something else:
-
+
>>> s.queryDefaultViewName(42, request)
'index.html'
-
+
"""
def test_default_skin_affects_lookup():
@@ -267,7 +266,7 @@
>>> s = pickle.loads(pickle.dumps(presentation))
>>> s is presentation
True
-
+
>>> layer = pickle.loads(pickle.dumps(presentation.queryLayer('default')))
>>> (layer is presentation.queryLayer('default')) and (layer is not None)
True
=== Zope3/src/zope/component/tests/test_service.py 1.5 => 1.6 ===
--- Zope3/src/zope/component/tests/test_service.py:1.5 Wed Dec 3 00:41:43 2003
+++ Zope3/src/zope/component/tests/test_service.py Tue Apr 20 07:01:21 2004
@@ -127,7 +127,7 @@
s = pickle.loads(pickle.dumps(s2))
self.assert_(s is s2)
testServiceManager._clear()
-
+
testServiceManager = GlobalServiceManager('testServiceManager', __name__)
=== Zope3/src/zope/component/tests/test_utilityservice.py 1.11 => 1.12 ===
--- Zope3/src/zope/component/tests/test_utilityservice.py:1.11 Sat Apr 17 10:33:58 2004
+++ Zope3/src/zope/component/tests/test_utilityservice.py Tue Apr 20 07:01:21 2004
@@ -82,7 +82,7 @@
self.assertEqual(
map(str, us.registrations()),
["UtilityRegistration('IDummyUtility', '', 'DummyUtility', '')"])
-
+
def test_suite():
return makeSuite(Test)
More information about the Zope3-Checkins
mailing list