[Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate/tests - testBasicTemplate.py:1.1.2.1 testDTMLTests.py:NONE
Fred L. Drake, Jr.
fdrake@acm.org
Mon, 4 Feb 2002 11:26:37 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv13786
Added Files:
Tag: Zope-3x-branch
testBasicTemplate.py
Removed Files:
Tag: Zope-3x-branch
testDTMLTests.py
Log Message:
Rename these tests; it is only marginally interesting that they were
created as translations of DTML tests, so that information is no longer used
in their name (where it is misleading) but is moved to a comment.
=== Added File Zope3/lib/python/Zope/PageTemplate/tests/testBasicTemplate.py ===
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (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.
# The tests in this module are translations of some of the DTML tests;
# the original DTML sources are shown in the docstrings for each
# test. The names of the test methods have been changed to be more
# meaningful.
import os, sys, unittest
from Zope.PageTemplate.tests import util
from Zope.PageTemplate.ZPT import ZPT
class BasicTemplateTests(unittest.TestCase):
def setUp(self):
self.t = ZPT()
def check_if_in_var(self):
"""DTML test 1: if, in, and var:
%(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.__get__(aa)()
expect = util.read_output('DTML1a.html')
util.check_xml(expect, o)
aa=util.argv(())
o=self.t.__get__(aa)()
expect = util.read_output('DTML1b.html')
util.check_xml(expect, o)
def check_batches_and_formatting(self):
"""DTML test 3: batches and formatting:
<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.__get__(aa)(batch=batch.batch(aa.args, 5))
expect = util.read_output('DTML3.html')
util.check_xml(expect, o)
def test_suite():
return unittest.makeSuite(BasicTemplateTests, 'check')
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())
=== Removed File Zope3/lib/python/Zope/PageTemplate/tests/testDTMLTests.py ===