[Zope3-checkins] CVS: Zope3/src/zope/pagetemplate/tests - batch.py:1.1.2.2 test_basictemplate.py:1.1.2.4 test_htmltests.py:1.1.2.3 util.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:42 -0500
Update of /cvs-repository/Zope3/src/zope/pagetemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/pagetemplate/tests
Modified Files:
Tag: NameGeddon-branch
batch.py test_basictemplate.py test_htmltests.py util.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/pagetemplate/tests/batch.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/pagetemplate/tests/batch.py:1.1.2.1 Mon Dec 23 14:32:59 2002
+++ Zope3/src/zope/pagetemplate/tests/batch.py Tue Dec 24 21:21: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.
-#
+#
##############################################################################
__allow_access_to_unprotected_subobjects__={'batch': 1}
__roles__=None
@@ -27,7 +27,7 @@
self._last=end-1
self._first=start-1
-
+
self._sequence=sequence
self._size=size
self._start=start
=== Zope3/src/zope/pagetemplate/tests/test_basictemplate.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/pagetemplate/tests/test_basictemplate.py:1.1.2.3 Tue Dec 24 10:57:52 2002
+++ Zope3/src/zope/pagetemplate/tests/test_basictemplate.py Tue Dec 24 21:21:11 2002
@@ -20,92 +20,92 @@
class BasicTemplateTests(unittest.TestCase):
- def setUp(self):
- self.t = PageTemplate()
+ def setUp(self):
+ self.t = PageTemplate()
- def test_if_in_var(self):
- # DTML test 1: if, in, and var:
- pass # for unittest
- """
- %(comment)[ blah %(comment)]
- <html><head><title>Test of documentation templates</title></head>
- <body>
- %(if args)[
- <dl><dt>The arguments to this test program were:<p>
- <dd>
- <ul>
- %(in args)[
- <li>Argument number %(num)d was %(arg)s
- %(in args)]
- </ul></dl><p>
- %(if args)]
- %(else args)[
- No arguments were given.<p>
- %(else args)]
- And thats da trooth.
- </body></html>
- """
- tal = util.read_input('dtml1.html')
- self.t.write(tal)
-
- aa = util.argv(('one', 'two', 'three', 'cha', 'cha', 'cha'))
- o = self.t(content=aa)
- expect = util.read_output('dtml1a.html')
-
- util.check_xml(expect, o)
-
- aa = util.argv(())
- o = self.t(content=aa)
- expect = util.read_output('dtml1b.html')
- util.check_xml(expect, o)
-
- def test_batches_and_formatting(self):
- # DTML test 3: batches and formatting:
- pass # for unittest
- """
+ def test_if_in_var(self):
+ # DTML test 1: if, in, and var:
+ pass # for unittest
+ """
+ %(comment)[ blah %(comment)]
<html><head><title>Test of documentation templates</title></head>
<body>
- <!--#if args-->
- The arguments were:
- <!--#in args size=size end=end-->
- <!--#if previous-sequence-->
- (<!--#var previous-sequence-start-arg-->-
- <!--#var previous-sequence-end-arg-->)
- <!--#/if previous-sequence-->
- <!--#if sequence-start-->
- <dl>
- <!--#/if sequence-start-->
- <dt><!--#var sequence-arg-->.</dt>
- <dd>Argument <!--#var num fmt=d--> was <!--#var arg--></dd>
- <!--#if next-sequence-->
- (<!--#var next-sequence-start-arg-->-
- <!--#var next-sequence-end-arg-->)
- <!--#/if next-sequence-->
- <!--#/in args-->
- </dl>
- <!--#else args-->
- No arguments were given.<p>
- <!--#/if args-->
- And I\'m 100% sure!
+ %(if args)[
+ <dl><dt>The arguments to this test program were:<p>
+ <dd>
+ <ul>
+ %(in args)[
+ <li>Argument number %(num)d was %(arg)s
+ %(in args)]
+ </ul></dl><p>
+ %(if args)]
+ %(else args)[
+ No arguments were given.<p>
+ %(else args)]
+ And thats da trooth.
</body></html>
- """
- tal = util.read_input('dtml3.html')
- self.t.write(tal)
-
- aa = util.argv(('one', 'two', 'three', 'four', 'five',
- 'six', 'seven', 'eight', 'nine', 'ten',
- 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',
- 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty',
- ))
- from zope.pagetemplate.tests import batch
- o = self.t(content=aa, batch=batch.batch(aa.args, 5))
+ """
+ tal = util.read_input('dtml1.html')
+ self.t.write(tal)
+
+ aa = util.argv(('one', 'two', 'three', 'cha', 'cha', 'cha'))
+ o = self.t(content=aa)
+ expect = util.read_output('dtml1a.html')
+
+ util.check_xml(expect, o)
+
+ aa = util.argv(())
+ o = self.t(content=aa)
+ expect = util.read_output('dtml1b.html')
+ util.check_xml(expect, o)
+
+ def test_batches_and_formatting(self):
+ # DTML test 3: batches and formatting:
+ pass # for unittest
+ """
+ <html><head><title>Test of documentation templates</title></head>
+ <body>
+ <!--#if args-->
+ The arguments were:
+ <!--#in args size=size end=end-->
+ <!--#if previous-sequence-->
+ (<!--#var previous-sequence-start-arg-->-
+ <!--#var previous-sequence-end-arg-->)
+ <!--#/if previous-sequence-->
+ <!--#if sequence-start-->
+ <dl>
+ <!--#/if sequence-start-->
+ <dt><!--#var sequence-arg-->.</dt>
+ <dd>Argument <!--#var num fmt=d--> was <!--#var arg--></dd>
+ <!--#if next-sequence-->
+ (<!--#var next-sequence-start-arg-->-
+ <!--#var next-sequence-end-arg-->)
+ <!--#/if next-sequence-->
+ <!--#/in args-->
+ </dl>
+ <!--#else args-->
+ No arguments were given.<p>
+ <!--#/if args-->
+ And I\'m 100% sure!
+ </body></html>
+ """
+ tal = util.read_input('dtml3.html')
+ self.t.write(tal)
+
+ aa = util.argv(('one', 'two', 'three', 'four', 'five',
+ 'six', 'seven', 'eight', 'nine', 'ten',
+ 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',
+ 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty',
+ ))
+ from zope.pagetemplate.tests import batch
+ o = self.t(content=aa, batch=batch.batch(aa.args, 5))
- expect = util.read_output('dtml3.html')
- util.check_xml(expect, o)
+ expect = util.read_output('dtml3.html')
+ util.check_xml(expect, o)
def test_suite():
- return unittest.makeSuite(BasicTemplateTests)
+ return unittest.makeSuite(BasicTemplateTests)
if __name__ == '__main__':
- unittest.TextTestRunner().run(test_suite())
+ unittest.TextTestRunner().run(test_suite())
=== Zope3/src/zope/pagetemplate/tests/test_htmltests.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/pagetemplate/tests/test_htmltests.py:1.1.2.2 Mon Dec 23 16:42:55 2002
+++ Zope3/src/zope/pagetemplate/tests/test_htmltests.py Tue Dec 24 21:21:11 2002
@@ -18,111 +18,111 @@
class Folder:
- context = property(lambda self: self)
+ context = property(lambda self: self)
class HTMLTests(unittest.TestCase):
- def setUp(self):
- self.folder = f = Folder()
- f.laf = PageTemplate()
- f.t = PageTemplate()
-
- def getProducts(self):
- return [
- {'description': 'This is the tee for those who LOVE Zope. '
- 'Show your heart on your tee.',
- 'price': 12.99, 'image': 'smlatee.jpg'
- },
- {'description': 'This is the tee for Jim Fulton. '
- 'He\'s the Zope Pope!',
- 'price': 11.99, 'image': 'smpztee.jpg'
- },
- ]
-
- def test_1(self):
- laf = self.folder.laf
- laf.write(util.read_input('teeshoplaf.html'))
- expect = util.read_output('teeshoplaf.html')
- util.check_html(expect, laf())
-
- def test_2(self):
- self.folder.laf.write(util.read_input('teeshoplaf.html'))
-
- t = self.folder.t
- t.write(util.read_input('teeshop2.html'))
- expect = util.read_output('teeshop2.html')
- out = t(laf = self.folder.laf, getProducts = self.getProducts)
- util.check_html(expect, out)
-
-
- def test_3(self):
- self.folder.laf.write(util.read_input('teeshoplaf.html'))
-
- t = self.folder.t
- t.write(util.read_input('teeshop1.html'))
- expect = util.read_output('teeshop1.html')
- out = t(laf = self.folder.laf, getProducts = self.getProducts)
- util.check_html(expect, out)
-
- def test_SimpleLoop(self):
- t = self.folder.t
- t.write(util.read_input('loop1.html'))
- expect = util.read_output('loop1.html')
- out = t()
- util.check_html(expect, out)
-
- def test_GlobalsShadowLocals(self):
- t = self.folder.t
- t.write(util.read_input('globalsshadowlocals.html'))
- expect = util.read_output('globalsshadowlocals.html')
- out = t()
- util.check_html(expect, out)
-
- def test_StringExpressions(self):
- t = self.folder.t
- t.write(util.read_input('stringexpression.html'))
- expect = util.read_output('stringexpression.html')
- out = t()
- util.check_html(expect, out)
-
- def test_ReplaceWithNothing(self):
- t = self.folder.t
- t.write(util.read_input('checknothing.html'))
- expect = util.read_output('checknothing.html')
- out = t()
- util.check_html(expect, out)
-
- def test_WithXMLHeader(self):
- t = self.folder.t
- t.write(util.read_input('checkwithxmlheader.html'))
- expect = util.read_output('checkwithxmlheader.html')
- out = t()
- util.check_html(expect, out)
-
- def test_NotExpression(self):
- t = self.folder.t
- t.write(util.read_input('checknotexpression.html'))
- expect = util.read_output('checknotexpression.html')
- out = t()
- util.check_html(expect, out)
-
- def test_PathNothing(self):
- t = self.folder.t
- t.write(util.read_input('checkpathnothing.html'))
- expect = util.read_output('checkpathnothing.html')
- out = t()
- util.check_html(expect, out)
-
- def test_PathAlt(self):
- t = self.folder.t
- t.write(util.read_input('checkpathalt.html'))
- expect = util.read_output('checkpathalt.html')
- out = t()
- util.check_html(expect, out)
+ def setUp(self):
+ self.folder = f = Folder()
+ f.laf = PageTemplate()
+ f.t = PageTemplate()
+
+ def getProducts(self):
+ return [
+ {'description': 'This is the tee for those who LOVE Zope. '
+ 'Show your heart on your tee.',
+ 'price': 12.99, 'image': 'smlatee.jpg'
+ },
+ {'description': 'This is the tee for Jim Fulton. '
+ 'He\'s the Zope Pope!',
+ 'price': 11.99, 'image': 'smpztee.jpg'
+ },
+ ]
+
+ def test_1(self):
+ laf = self.folder.laf
+ laf.write(util.read_input('teeshoplaf.html'))
+ expect = util.read_output('teeshoplaf.html')
+ util.check_html(expect, laf())
+
+ def test_2(self):
+ self.folder.laf.write(util.read_input('teeshoplaf.html'))
+
+ t = self.folder.t
+ t.write(util.read_input('teeshop2.html'))
+ expect = util.read_output('teeshop2.html')
+ out = t(laf = self.folder.laf, getProducts = self.getProducts)
+ util.check_html(expect, out)
+
+
+ def test_3(self):
+ self.folder.laf.write(util.read_input('teeshoplaf.html'))
+
+ t = self.folder.t
+ t.write(util.read_input('teeshop1.html'))
+ expect = util.read_output('teeshop1.html')
+ out = t(laf = self.folder.laf, getProducts = self.getProducts)
+ util.check_html(expect, out)
+
+ def test_SimpleLoop(self):
+ t = self.folder.t
+ t.write(util.read_input('loop1.html'))
+ expect = util.read_output('loop1.html')
+ out = t()
+ util.check_html(expect, out)
+
+ def test_GlobalsShadowLocals(self):
+ t = self.folder.t
+ t.write(util.read_input('globalsshadowlocals.html'))
+ expect = util.read_output('globalsshadowlocals.html')
+ out = t()
+ util.check_html(expect, out)
+
+ def test_StringExpressions(self):
+ t = self.folder.t
+ t.write(util.read_input('stringexpression.html'))
+ expect = util.read_output('stringexpression.html')
+ out = t()
+ util.check_html(expect, out)
+
+ def test_ReplaceWithNothing(self):
+ t = self.folder.t
+ t.write(util.read_input('checknothing.html'))
+ expect = util.read_output('checknothing.html')
+ out = t()
+ util.check_html(expect, out)
+
+ def test_WithXMLHeader(self):
+ t = self.folder.t
+ t.write(util.read_input('checkwithxmlheader.html'))
+ expect = util.read_output('checkwithxmlheader.html')
+ out = t()
+ util.check_html(expect, out)
+
+ def test_NotExpression(self):
+ t = self.folder.t
+ t.write(util.read_input('checknotexpression.html'))
+ expect = util.read_output('checknotexpression.html')
+ out = t()
+ util.check_html(expect, out)
+
+ def test_PathNothing(self):
+ t = self.folder.t
+ t.write(util.read_input('checkpathnothing.html'))
+ expect = util.read_output('checkpathnothing.html')
+ out = t()
+ util.check_html(expect, out)
+
+ def test_PathAlt(self):
+ t = self.folder.t
+ t.write(util.read_input('checkpathalt.html'))
+ expect = util.read_output('checkpathalt.html')
+ out = t()
+ util.check_html(expect, out)
def test_suite():
- return unittest.makeSuite(HTMLTests)
+ return unittest.makeSuite(HTMLTests)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())
=== Zope3/src/zope/pagetemplate/tests/util.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/pagetemplate/tests/util.py:1.1.2.2 Mon Dec 23 16:42:55 2002
+++ Zope3/src/zope/pagetemplate/tests/util.py Tue Dec 24 21:21: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.
-#
+#
##############################################################################
import os
import re
@@ -35,7 +35,7 @@
raise AttributeError, name
return self
-bruce = Bruce()
+bruce = Bruce()
class arg:
__allow_access_to_unprotected_subobjects__ = 1