[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/tests - testZPTPage.py:1.6
Fred L. Drake, Jr.
fred@zope.com
Thu, 5 Dec 2002 12:37:43 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/tests
In directory cvs.zope.org:/tmp/cvs-serv16342
Modified Files:
testZPTPage.py
Log Message:
setSource() now requires the source text to be Unicode. This takes
care of the encoding issue previously noted in SearchableText
comments.
=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/tests/testZPTPage.py 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/tests/testZPTPage.py:1.5 Thu Dec 5 07:36:48 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/tests/testZPTPage.py Thu Dec 5 12:37:42 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.
-#
+#
##############################################################################
"""
Basic tests for Page Templates used in content-space.
@@ -37,9 +37,9 @@
class Data(object):
def __init__(self, **kw):
self.__dict__.update(kw)
-
-
+
+
class ZPTPageTests(PlacelessSetup, unittest.TestCase):
def setUp(self):
@@ -48,24 +48,19 @@
provideAdapter(None, ITraversable, DefaultTraversable)
provideAdapter(IZPTPage, ISearchableText, SearchableText)
defineChecker(Data, NamesChecker(['URL', 'name']))
-
+
def testSearchableText(self):
page = ZPTPage()
- text = 'this is a test\n' ## The source will return with a newline if its ommited
- utext = u'another test\n'
-
- page.setSource(text)
- searchableText = getAdapter(page, ISearchableText)
- self.failUnlessEqual(searchableText.getSearchableText(), [unicode(text)])
+ utext = u'another test\n' # The source will grow a newline if ommited
page.setSource(utext)
+ searchableText = getAdapter(page, ISearchableText)
self.failUnlessEqual(searchableText.getSearchableText(), [utext])
-
-
-
+
def testZPTRendering(self):
page = ZPTPage()
page.setSource(
+ u''
'<html>'
'<head><title tal:content="options/title">blah</title></head>'
'<body>'