1
##############################################################################
3
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
5
# This software is subject to the provisions of the Zope Public License,
6
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
7
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10
# FOR A PARTICULAR PURPOSE
12
##############################################################################
13
"""Document Template Tests
18
from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase
20
class TestDT_If(DTMLTestBase):
25
html = self.doc_class(
28
The arguments were: <dtml-var value>
32
result1 = u"The arguments were: foo"
35
self.assertEqual(html(value='foo').strip(), result1.strip())
36
self.assertEqual(html().strip(), result2.strip())
41
html = self.doc_class(
44
The arguments were: <dtml-var value>
46
No arguments were given.
50
result1 = u"The arguments were: foo"
51
result2 = u"No arguments were given."
53
self.assertEqual(html(value='foo').strip(), result1.strip())
54
self.assertEqual(html().strip(), result2.strip())
58
html = self.doc_class(
61
The arguments were: <dtml-var value>
63
The attributes were: <dtml-var attribute>
67
result1 = u"The arguments were: foo"
68
result2 = u"The attributes were: bar"
70
self.assertEqual(html(value='foo', attribute='').strip(),
72
self.assertEqual(html(value='', attribute='bar').strip(),
77
suite = unittest.TestSuite()
78
suite.addTest(unittest.makeSuite(TestDT_If))
83
if __name__ == '__main__':
84
unittest.TextTestRunner().run(test_suite())