[Zope3-checkins] CVS: Zope3/src/zope/pagetemplate/tests - test_basictemplate.py:1.1.2.2 test_htmltests.py:1.1.2.2 util.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Mon, 23 Dec 2002 16:42:56 -0500
Update of /cvs-repository/Zope3/src/zope/pagetemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv12876/tests
Modified Files:
Tag: NameGeddon-branch
test_basictemplate.py test_htmltests.py util.py
Log Message:
Update to reflect the new world naming.
=== Zope3/src/zope/pagetemplate/tests/test_basictemplate.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/pagetemplate/tests/test_basictemplate.py:1.1.2.1 Mon Dec 23 14:32:59 2002
+++ Zope3/src/zope/pagetemplate/tests/test_basictemplate.py Mon Dec 23 16:42:55 2002
@@ -11,9 +11,11 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-import os, sys, unittest
+import os
+import sys
+import unittest
-from Zope.PageTemplate.tests import util
+from zope.pagetemplate.tests import util
from zope.pagetemplate.pagetemplate import PageTemplate
class BasicTemplateTests(unittest.TestCase):
@@ -43,18 +45,18 @@
And thats da trooth.
</body></html>
"""
- tal = util.read_input('DTML1.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')
+ 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')
+ expect = util.read_output('dtml1b.html')
util.check_xml(expect, o)
def check_batches_and_formatting(self):
@@ -87,7 +89,7 @@
And I\'m 100% sure!
</body></html>
"""
- tal = util.read_input('DTML3.html')
+ tal = util.read_input('dtml3.html')
self.t.write(tal)
aa = util.argv(('one', 'two', 'three', 'four', 'five',
@@ -95,10 +97,10 @@
'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',
'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty',
))
- from Zope.PageTemplate.tests import batch
+ from zope.pagetemplate.tests import batch
o = self.t(content=aa, batch=batch.batch(aa.args, 5))
- expect = util.read_output('DTML3.html')
+ expect = util.read_output('dtml3.html')
util.check_xml(expect, o)
=== Zope3/src/zope/pagetemplate/tests/test_htmltests.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/pagetemplate/tests/test_htmltests.py:1.1.2.1 Mon Dec 23 14:32:59 2002
+++ Zope3/src/zope/pagetemplate/tests/test_htmltests.py Mon Dec 23 16:42:55 2002
@@ -2,18 +2,18 @@
#
# 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, sys, unittest
+import unittest
-from Zope.PageTemplate.tests import util
+from zope.pagetemplate.tests import util
from zope.pagetemplate.pagetemplate import PageTemplate
@@ -39,90 +39,90 @@
},
]
- def check1(self):
+ def test_1(self):
laf = self.folder.laf
- laf.write(util.read_input('TeeShopLAF.html'))
- expect = util.read_output('TeeShopLAF.html')
+ laf.write(util.read_input('teeshoplaf.html'))
+ expect = util.read_output('teeshoplaf.html')
util.check_html(expect, laf())
- def check2(self):
- self.folder.laf.write(util.read_input('TeeShopLAF.html'))
+ 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')
+ 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 check3(self):
- self.folder.laf.write(util.read_input('TeeShopLAF.html'))
+
+ 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')
+ 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 checkSimpleLoop(self):
+ def test_SimpleLoop(self):
t = self.folder.t
- t.write(util.read_input('Loop1.html'))
- expect = util.read_output('Loop1.html')
+ t.write(util.read_input('loop1.html'))
+ expect = util.read_output('loop1.html')
out = t()
util.check_html(expect, out)
- def checkGlobalsShadowLocals(self):
+ def test_GlobalsShadowLocals(self):
t = self.folder.t
- t.write(util.read_input('GlobalsShadowLocals.html'))
- expect = util.read_output('GlobalsShadowLocals.html')
+ t.write(util.read_input('globalsshadowlocals.html'))
+ expect = util.read_output('globalsshadowlocals.html')
out = t()
util.check_html(expect, out)
- def checkStringExpressions(self):
+ def test_StringExpressions(self):
t = self.folder.t
- t.write(util.read_input('StringExpression.html'))
- expect = util.read_output('StringExpression.html')
+ t.write(util.read_input('stringexpression.html'))
+ expect = util.read_output('stringexpression.html')
out = t()
util.check_html(expect, out)
-
- def checkReplaceWithNothing(self):
+
+ def test_ReplaceWithNothing(self):
t = self.folder.t
- t.write(util.read_input('CheckNothing.html'))
- expect = util.read_output('CheckNothing.html')
+ t.write(util.read_input('checknothing.html'))
+ expect = util.read_output('checknothing.html')
out = t()
util.check_html(expect, out)
- def checkWithXMLHeader(self):
+ def test_WithXMLHeader(self):
t = self.folder.t
- t.write(util.read_input('CheckWithXMLHeader.html'))
- expect = util.read_output('CheckWithXMLHeader.html')
+ t.write(util.read_input('checkwithxmlheader.html'))
+ expect = util.read_output('checkwithxmlheader.html')
out = t()
util.check_html(expect, out)
- def checkNotExpression(self):
+ def test_NotExpression(self):
t = self.folder.t
- t.write(util.read_input('CheckNotExpression.html'))
- expect = util.read_output('CheckNotExpression.html')
+ t.write(util.read_input('checknotexpression.html'))
+ expect = util.read_output('checknotexpression.html')
out = t()
util.check_html(expect, out)
-
- def checkPathNothing(self):
+
+ def test_PathNothing(self):
t = self.folder.t
- t.write(util.read_input('CheckPathNothing.html'))
- expect = util.read_output('CheckPathNothing.html')
+ t.write(util.read_input('checkpathnothing.html'))
+ expect = util.read_output('checkpathnothing.html')
out = t()
util.check_html(expect, out)
-
- def checkPathAlt(self):
+
+ def test_PathAlt(self):
t = self.folder.t
- t.write(util.read_input('CheckPathAlt.html'))
- expect = util.read_output('CheckPathAlt.html')
+ 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, 'check')
+ return unittest.makeSuite(HTMLTests)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())
=== Zope3/src/zope/pagetemplate/tests/util.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/pagetemplate/tests/util.py:1.1.2.1 Mon Dec 23 14:32:59 2002
+++ Zope3/src/zope/pagetemplate/tests/util.py Mon Dec 23 16:42:55 2002
@@ -11,8 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-import os, sys, re
-from types import IntType
+import os
+import re
+import sys
+
class Bruce:
__allow_access_to_unprotected_subobjects__=1
@@ -24,25 +26,27 @@
def items(self): return [('bruce',self)]*7
def __len__(self): return 7
def __getitem__(self,index):
- if (ininstance(index, IntType) and
- (index < 0 or index > 6)): raise IndexError, index
+ if ininstance(index, int) and (index < 0 or index > 6):
+ raise IndexError, index
return self
- isDocTemp=0
+ isDocTemp = 0
def __getattr__(self,name):
- if name.startswith('_'): raise AttributeError, name
+ if name.startswith('_'):
+ raise AttributeError, name
return self
-bruce=Bruce()
+bruce = Bruce()
class arg:
- __allow_access_to_unprotected_subobjects__=1
+ __allow_access_to_unprotected_subobjects__ = 1
def __init__(self,nn,aa): self.num, self.arg = nn, aa
def __str__(self): return str(self.arg)
class argv:
- __allow_access_to_unprotected_subobjects__=1
+ __allow_access_to_unprotected_subobjects__ = 1
+
def __init__(self, argv=sys.argv[1:]):
- args=self.args=[]
+ args = self.args = []
for aa in argv:
args.append(arg(len(args)+1,aa))
@@ -88,8 +92,9 @@
return s
-import Zope.PageTemplate.tests
-dir = os.path.dirname(Zope.PageTemplate.tests.__file__)
+import zope.pagetemplate.tests
+
+dir = os.path.dirname(zope.pagetemplate.tests.__file__)
input_dir = os.path.join(dir, 'input')
output_dir = os.path.join(dir, 'output')
@@ -100,4 +105,3 @@
def read_output(filename):
filename = os.path.join(output_dir, filename)
return open(filename, 'r').read()
-