[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate/tests - sample.py:1.1.2.2 simpletestview.py:1.1.2.2 test_binding.py:1.1.2.2 test_simpleviewclass.py:1.1.2.2 test_viewzpt.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Mon, 23 Dec 2002 17:34:50 -0500
Update of /cvs-repository/Zope3/src/zope/app/pagetemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv21276
Modified Files:
Tag: NameGeddon-branch
sample.py simpletestview.py test_binding.py
test_simpleviewclass.py test_viewzpt.py
Log Message:
Get many of the import problems fixed here. Not yet complete.
=== Zope3/src/zope/app/pagetemplate/tests/sample.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/pagetemplate/tests/sample.py:1.1.2.1 Mon Dec 23 14:31:57 2002
+++ Zope3/src/zope/app/pagetemplate/tests/sample.py Mon Dec 23 17:34:19 2002
@@ -2,23 +2,21 @@
#
# 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.
-#
+#
##############################################################################
"""
Revision information: $Id$
"""
-import os
-from Zope.App.PageTemplate import ViewPageTemplateFile
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
class C:
-
index = ViewPageTemplateFile('test.pt')
=== Zope3/src/zope/app/pagetemplate/tests/simpletestview.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/pagetemplate/tests/simpletestview.py:1.1.2.1 Mon Dec 23 14:31:57 2002
+++ Zope3/src/zope/app/pagetemplate/tests/simpletestview.py Mon Dec 23 17:34:19 2002
@@ -14,4 +14,4 @@
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-SimpleTestView = SimpleViewClass('testSimpleViewClass.pt')
+SimpleTestView = SimpleViewClass('testsimpleviewclass.pt')
=== Zope3/src/zope/app/pagetemplate/tests/test_binding.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/pagetemplate/tests/test_binding.py:1.1.2.1 Mon Dec 23 14:31:57 2002
+++ Zope3/src/zope/app/pagetemplate/tests/test_binding.py Mon Dec 23 17:34:19 2002
@@ -2,18 +2,19 @@
#
# 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
-from Zope.PageTemplate.tests import util
+
+from zope.pagetemplate.tests import util
from zope.app.pagetemplate.tests.testpackage.content \
import Content, PTComponent
=== Zope3/src/zope/app/pagetemplate/tests/test_simpleviewclass.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/pagetemplate/tests/test_simpleviewclass.py:1.1.2.1 Mon Dec 23 14:31:57 2002
+++ Zope3/src/zope/app/pagetemplate/tests/test_simpleviewclass.py Mon Dec 23 17:34:19 2002
@@ -2,28 +2,27 @@
#
# 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
-
+import unittest
class data: pass
-class Test(unittest.TestCase):
+class SimpleViewTestCase(unittest.TestCase):
- def test(self):
+ def test_simple(self):
from zope.app.pagetemplate.tests.simpletestview import SimpleTestView
-
+
ob = data()
- view = SimpleTestView(ob, None)
+ view = SimpleTestView(ob, None)
macro = view['test']
out = view()
self.assertEqual(out,
@@ -32,17 +31,17 @@
' <p>hello world</p>\n'
' </body>\n</html>\n')
- def testWBases(self):
+ def test_WBases(self):
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
class C: pass
-
- SimpleTestView = SimpleViewClass('testSimpleViewClass.pt', bases=(C, ))
-
+
+ SimpleTestView = SimpleViewClass('testsimpleviewclass.pt', bases=(C, ))
+
self.failUnless(issubclass(SimpleTestView, C))
ob = data()
- view = SimpleTestView(ob, None)
+ view = SimpleTestView(ob, None)
macro = view['test']
out = view()
self.assertEqual(out,
@@ -52,9 +51,8 @@
' </body>\n</html>\n')
def test_suite():
- loader=unittest.TestLoader()
- return loader.loadTestsFromTestCase(Test)
+ loader = unittest.TestLoader()
+ return loader.loadTestsFromTestCase(SimpleViewTestCase)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())
-
=== Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py:1.1.2.1 Mon Dec 23 14:31:57 2002
+++ Zope3/src/zope/app/pagetemplate/tests/test_viewzpt.py Mon Dec 23 17:34:19 2002
@@ -2,23 +2,26 @@
#
# 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 os, sys, unittest
+import os
+import sys
+import unittest
-from Zope.App.PageTemplate import ViewPageTemplateFile
from zope.testing.cleanup import CleanUp
from zope.component import getService
from zope.interface import Interface
-from zope.app.services.tests.placefulsetup\
- import PlacefulSetup
+
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.services.tests.placefulsetup import PlacefulSetup
+
class I1(Interface):
pass
@@ -39,35 +42,35 @@
PlacefulSetup.setUp(self)
self.t = ViewPageTemplateFile('test.pt')
self.context = C1()
-
+
def checkNamespaceContextAvailable(self):
context = self.context
request = None
-
+
namespace = self.t.pt_getContext(InstanceWithContext(context), request)
self.failUnless(namespace['context'] is context)
self.failUnless('views' in namespace)
-
-
+
+
def checkNamespaceHereNotAvailable(self):
- request = None
+ request = None
self.assertRaises(AttributeError, self.t.pt_getContext,
InstanceWithoutContext(), request)
-
+
def checkViewMapper(self):
-
+
the_view = "This is the view"
class the_view_type(Interface): pass
the_view_name = "some view name"
def ViewMaker(*args, **kw):
return the_view
-
+
getService(None,"Views").provideView(I1,
name=the_view_name,
type=the_view_type,
maker=[ViewMaker])
-
+
from zope.component.interfaces \
import IPresentationRequest
@@ -77,15 +80,15 @@
return the_view_type
def getPresentationSkin(self):
return "some skin"
-
+
request = MyRequest()
namespace = self.t.pt_getContext(InstanceWithContext(self.context),
request)
views = namespace['views']
self.failUnless(the_view is views[the_view_name])
-
-
+
+
def test_suite():
return unittest.makeSuite(TestViewZPT, 'check')