[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testDefaultTraverser.py:1.1.2.11
Steve Alexander
steve@cat-box.net
Tue, 9 Apr 2002 09:13:09 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/tests
In directory cvs.zope.org:/tmp/cvs-serv6427/App/ZopePublication/tests
Modified Files:
Tag: Zope-3x-branch
testDefaultTraverser.py
Log Message:
removed <cr> characters from the ends of lines
=== Zope3/lib/python/Zope/App/ZopePublication/tests/testDefaultTraverser.py 1.1.2.10 => 1.1.2.11 ===
$Id$
"""
-
-import unittest, sys
-from Zope.ComponentArchitecture.tests.Request import Request
-from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
-from Zope.ComponentArchitecture import provideView
-from Zope.App.ZopePublication.Traversers import DefaultTraverser
-from Interface import Interface
-from Zope.Exceptions import NotFoundError
-
-
-class I(Interface): pass
-
-
-class Container:
-
- def __init__(self, **kw):
-
- for k in kw:
- setattr(self, k , kw[k])
-
-
- def getObject(self, name, default=None):
-
- return getattr(self, name, default)
-
-
-class Request(Request):
-
- def getEffectiveURL(self):
- return ''
-
-
-class View:
-
- def __init__(self, comp):
- self._comp = comp
-
-
-
-class Test(CleanUp, unittest.TestCase):
-
- def testAttr(self):
- """ test container traver """
-
- foo = Container()
- c = Container( foo=foo )
- req = Request( I, '')
-
- T = DefaultTraverser(c)
- self.failUnless(T.publishTraverse(req,'foo') is foo)
-
- self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
-
-
- def testView(self):
- """ test getting a view """
-
-
- foo = Container()
- c = Container( foo=foo )
- req = Request( I, '')
-
- T = DefaultTraverser(c)
- provideView(None , 'foo', I, View)
-
- self.failUnless(T.publishTraverse(req,'foo;view').__class__ is View )
- self.failUnless(T.publishTraverse(req,'foo') is foo)
-
- self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
- self.assertRaises(NotFoundError , T.publishTraverse, req ,
- 'morebar;view')
-
-
-
-def test_suite():
- loader=unittest.TestLoader()
- return loader.loadTestsFromTestCase(Test)
-
-if __name__=='__main__':
- unittest.TextTestRunner().run(test_suite())
+
+import unittest, sys
+from Zope.ComponentArchitecture.tests.Request import Request
+from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
+from Zope.ComponentArchitecture import provideView
+from Zope.App.ZopePublication.Traversers import DefaultTraverser
+from Interface import Interface
+from Zope.Exceptions import NotFoundError
+
+
+class I(Interface): pass
+
+
+class Container:
+
+ def __init__(self, **kw):
+
+ for k in kw:
+ setattr(self, k , kw[k])
+
+
+ def getObject(self, name, default=None):
+
+ return getattr(self, name, default)
+
+
+class Request(Request):
+
+ def getEffectiveURL(self):
+ return ''
+
+
+class View:
+
+ def __init__(self, comp):
+ self._comp = comp
+
+
+
+class Test(CleanUp, unittest.TestCase):
+
+ def testAttr(self):
+ """ test container traver """
+
+ foo = Container()
+ c = Container( foo=foo )
+ req = Request( I, '')
+
+ T = DefaultTraverser(c)
+ self.failUnless(T.publishTraverse(req,'foo') is foo)
+
+ self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
+
+
+ def testView(self):
+ """ test getting a view """
+
+
+ foo = Container()
+ c = Container( foo=foo )
+ req = Request( I, '')
+
+ T = DefaultTraverser(c)
+ provideView(None , 'foo', I, View)
+
+ self.failUnless(T.publishTraverse(req,'foo;view').__class__ is View )
+ self.failUnless(T.publishTraverse(req,'foo') is foo)
+
+ self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
+ self.assertRaises(NotFoundError , T.publishTraverse, req ,
+ 'morebar;view')
+
+
+
+def test_suite():
+ loader=unittest.TestLoader()
+ return loader.loadTestsFromTestCase(Test)
+
+if __name__=='__main__':
+ unittest.TextTestRunner().run(test_suite())