[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testSimpleComponentTraverser.py:1.4
Barry Warsaw
barry@wooz.org
Fri, 20 Dec 2002 15:22:13 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/tests
In directory cvs.zope.org:/tmp/cvs-serv18378/lib/python/Zope/App/ZopePublication/tests
Modified Files:
testSimpleComponentTraverser.py
Log Message:
test module cleanups:
- no docstrings in test methods (convert to comments)
- whitespace normalization
- other minor cleanups
=== Zope3/lib/python/Zope/App/ZopePublication/tests/testSimpleComponentTraverser.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/ZopePublication/tests/testSimpleComponentTraverser.py:1.3 Fri Oct 4 14:37:25 2002
+++ Zope3/lib/python/Zope/App/ZopePublication/tests/testSimpleComponentTraverser.py Fri Dec 20 15:22:11 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.
-#
+#
##############################################################################
"""
@@ -24,69 +24,60 @@
from Zope.Exceptions import NotFoundError
from Zope.App.tests.PlacelessSetup import PlacelessSetup
-class I(Interface): pass
+class I(Interface):
+ pass
class Container:
-
def __init__(self, **kw):
-
for k in kw:
setattr(self, k , kw[k])
-
def get(self, name, default=None):
-
return getattr(self, name, default)
-
-class Request(Request):
+class Request(Request):
def getEffectiveURL(self):
return ''
class View:
-
def __init__(self, comp, request):
self._comp = comp
-
class Test(PlacelessSetup, unittest.TestCase):
-
def testAttr(self):
- """ test container traver """
-
+ # test container traver
foo = Container()
c = Container( foo=foo )
req = Request( I, '')
-
+
T = SimpleComponentTraverser(c, req)
-
+
self.assertRaises(NotFoundError , T.publishTraverse, req ,'foo')
def testView(self):
- """ test getting a view """
-
-
+ # test getting a view
foo = Container()
c = Container( foo=foo )
req = Request( I, '')
-
+
T = SimpleComponentTraverser(c, req)
getService(None,"Views").provideView(None , 'foo', I, [View])
-
+
self.failUnless(T.publishTraverse(req,'foo').__class__ is View )
-
+
self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
-
+
def test_suite():
- loader=unittest.TestLoader()
+ loader = unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
-if __name__=='__main__':
+
+if __name__ == '__main__':
unittest.TextTestRunner().run(test_suite())