[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate/tests - testDTML.py:1.5.4.2
Shane Hathaway
shane@digicool.com
Fri, 21 Dec 2001 14:23:31 -0500
Update of /cvs-repository/Zope/lib/python/DocumentTemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv7672
Modified Files:
Tag: Zope-2_4-branch
testDTML.py
Log Message:
Backported test suite correction
=== Zope/lib/python/DocumentTemplate/tests/testDTML.py 1.5.4.1 => 1.5.4.2 ===
doc_class = HTML
- def checkBatchingEtc(self):
+ def testBatchingEtc(self):
def item(key,**kw): return (key,kw)
def item2(key,**kw): return kw
@@ -239,7 +239,7 @@
expected = read_file('dealers.out')
assert res == expected, res
- def checkSequenceSummaries(self):
+ def testSequenceSummaries(self):
def d(**kw): return kw
data=(d(name='jim', age=38),
# d(name='kak', age=40),
@@ -274,7 +274,7 @@
'median=5 mean=12.5 s.d.=17')
assert res == expected, res
- def checkDTMLDateFormatting(self):
+ def testDTMLDateFormatting(self):
import DateTime
html = self.doc_class(
"<dtml-var name capitalize spacify> is "
@@ -285,13 +285,13 @@
expected = 'Christmas day is 1995/12/25'
assert res == expected, res
- def checkSimpleString(self):
+ def testSimpleString(self):
dt = String('%(name)s')
res = dt(name='Chris')
expected = 'Chris'
assert res == expected, res
- def checkStringDateFormatting(self):
+ def testStringDateFormatting(self):
import DateTime
html = String("%(name capitalize spacify)s is "
"%(date fmt=year)s/%(date fmt=month)s/%(date fmt=day)s")
@@ -300,7 +300,7 @@
expected = 'The date is 2001/4/27'
assert res == expected, res
- def checkSequence1(self):
+ def testSequence1(self):
html=self.doc_class(
'<dtml-in spam><dtml-in sequence-item><dtml-var sequence-item> '
'</dtml-in sequence-item></dtml-in spam>')
@@ -308,7 +308,7 @@
res = html(spam=[[1,2,3],[4,5,6]])
assert res == expected, res
- def checkSequence2(self):
+ def testSequence2(self):
html=self.doc_class(
'<dtml-in spam><dtml-in sequence-item><dtml-var sequence-item>-'
'</dtml-in sequence-item></dtml-in spam>')
@@ -316,14 +316,14 @@
res = html(spam=[[1,2,3],[4,5,6]])
assert res == expected, res
- def checkNull(self):
+ def testNull(self):
html=self.doc_class('<dtml-var spam fmt="$%.2f bobs your uncle" '
'null="spam%eggs!|">')
expected = '$42.00 bobs your unclespam%eggs!|'
res = html(spam=42) + html(spam=None)
assert res == expected, res
- def check_fmt(self):
+ def test_fmt(self):
html=self.doc_class(
"""
<dtml-var spam>
@@ -369,7 +369,7 @@
spam='<a href="spam">\nfoo bar')
assert res == expected, res
- def checkPropogatedError(self):
+ def testPropogatedError(self):
class foo:
def __len__(self): return 9
@@ -408,7 +408,7 @@
else:
assert 0, 'Puke error not propogated'
- def checkRenderCallable(self):
+ def testRenderCallable(self):
"Test automatic rendering of callable objects"
class C (Base):
__allow_access_to_unprotected_subobjects__ = 1
@@ -433,7 +433,7 @@
<dtml-var expr="_.render(i.h2)">''')(i=C())
assert res == expected, res
- def checkWith(self):
+ def testWith(self):
class person:
__allow_access_to_unprotected_subobjects__ = 1
name='Jim'
@@ -448,7 +448,7 @@
'cm.</dtml-with>')(person=person)
assert res == expected, res
- def checkRaise(self):
+ def testRaise(self):
try:
res = self.doc_class(
"<dtml-raise IndexError>success!</dtml-raise>")()
@@ -457,7 +457,7 @@
assert str(res) == 'success!', `res`
- def checkBasicHTMLIn(self):
+ def testBasicHTMLIn(self):
data=(
d(name='jim', age=39),
d(name='kak', age=29),
@@ -481,7 +481,7 @@
result = self.doc_class(html)(data=data)
assert result == expected, result
- def checkBasicHTMLIn2(self):
+ def testBasicHTMLIn2(self):
xxx=(D(name=1), D(name=2), D(name=3))
html = """
<!--#in xxx-->
@@ -496,7 +496,7 @@
result = self.doc_class(html)(xxx=xxx)
assert result == expected, result
- def checkBasicHTMLIn3(self):
+ def testBasicHTMLIn3(self):
ns = {'prop_ids': ('title', 'id'), 'title': 'good', 'id': 'times'}
html = """:<dtml-in prop_ids><dtml-var sequence-item>=<dtml-var
expr="_[_['sequence-item']]">:</dtml-in>"""
@@ -505,7 +505,7 @@
assert result == expected, result
- def checkHTMLInElse(self):
+ def testHTMLInElse(self):
xxx=(D(name=1), D(name=2), D(name=3))
html="""
<!--#in data mapping-->
@@ -524,7 +524,7 @@
result = self.doc_class(html)(xxx=xxx, data={})
assert result == expected, result
- def checkBasicStringIn(self):
+ def testBasicStringIn(self):
data=(
d(name='jim', age=39),
d(name='kak', age=29),
@@ -548,7 +548,7 @@
assert expected == result, result
def test_suite():
- return unittest.makeSuite(DTMLTests, 'check')
+ return unittest.makeSuite(DTMLTests)
def main():
alltests = test_suite()