[Zope3-checkins] CVS: Zope3/lib/python/Zope/PageTemplate/tests - testBasicTemplate.py:1.3 testExpressions.py:1.3 testTALES.py:1.3

Barry Warsaw barry@wooz.org
Fri, 20 Dec 2002 14:35:17 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv11652/lib/python/Zope/PageTemplate/tests

Modified Files:
	testBasicTemplate.py testExpressions.py testTALES.py 
Log Message:
test module cleanups:

- no docstrings in test methods (convert to comments)
- whitespace normalization
- other minor cleanups


=== Zope3/lib/python/Zope/PageTemplate/tests/testBasicTemplate.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/PageTemplate/tests/testBasicTemplate.py:1.2	Mon Jun 10 19:29:30 2002
+++ Zope3/lib/python/Zope/PageTemplate/tests/testBasicTemplate.py	Fri Dec 20 14:34:46 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, sys, unittest
 
@@ -22,8 +22,9 @@
       self.t = PageTemplate()
 
    def check_if_in_var(self):
-      """DTML test 1: if, in, and var:
-
+      # DTML test 1: if, in, and var:
+      pass # for unittest
+      """
       %(comment)[ blah %(comment)]
       <html><head><title>Test of documentation templates</title></head>
       <body>
@@ -57,8 +58,9 @@
       util.check_xml(expect, o)
 
    def check_batches_and_formatting(self):
-      """DTML test 3: batches and formatting:
-
+      # DTML test 3: batches and formatting:
+      pass # for unittest
+      """
         <html><head><title>Test of documentation templates</title></head>
         <body>
         <!--#if args-->
@@ -93,7 +95,7 @@
                       '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')


=== Zope3/lib/python/Zope/PageTemplate/tests/testExpressions.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/PageTemplate/tests/testExpressions.py:1.2	Mon Jun 10 19:29:30 2002
+++ Zope3/lib/python/Zope/PageTemplate/tests/testExpressions.py	Fri Dec 20 14:34:46 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, sys, unittest
 
@@ -22,12 +22,15 @@
 
     def __repr__(self): return self.name
 
-def dict(**kw): return kw
+
+def dict(**kw):
+    return kw
+
 
 class ExpressionTests(unittest.TestCase):
 
     def testCompile(self):
-        '''Test expression compilation'''
+        # Test expression compilation
         context = Data(
             vars = dict(
               x = Data(
@@ -42,10 +45,10 @@
               B = 2,
               )
             )
-              
-        
+
+
         engine = Engine
-        
+
         expr = engine.compile('x')
         self.assertEqual(expr(context), context.vars['x'])
 
@@ -72,9 +75,11 @@
 
         expr = engine.compile('python: 2 \n+\n 2\n')
         self.assertEqual(expr(context), 4)
-        
+
+
 def test_suite():
     return unittest.makeSuite(ExpressionTests)
 
-if __name__=='__main__':
+
+if __name__ == '__main__':
     unittest.TextTestRunner().run(test_suite())


=== Zope3/lib/python/Zope/PageTemplate/tests/testTALES.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/PageTemplate/tests/testTALES.py:1.2	Mon Jun 10 19:29:30 2002
+++ Zope3/lib/python/Zope/PageTemplate/tests/testTALES.py	Fri Dec 20 14:34:46 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, sys, unittest
 
@@ -20,14 +20,14 @@
 class TALESTests(unittest.TestCase):
 
     def testIterator0(self):
-        '''Test sample Iterator class'''
+        # Test sample Iterator class
         context = harness1()
         it = TALES.Iterator('name', (), context)
         assert not it.next(), "Empty iterator"
         context._complete_()
 
     def testIterator1(self):
-        '''Test sample Iterator class'''
+        # Test sample Iterator class
         context = harness1()
         it = TALES.Iterator('name', (1,), context)
         context._assert_('setLocal', 'name', 1)
@@ -35,7 +35,7 @@
         context._complete_()
 
     def testIterator2(self):
-        '''Test sample Iterator class'''
+        # Test sample Iterator class
         context = harness1()
         it = TALES.Iterator('text', 'text', context)
         for c in 'text':
@@ -46,13 +46,13 @@
         context._complete_()
 
     def testRegisterType(self):
-        '''Test expression type registration'''
+        # Test expression type registration
         e = TALES.ExpressionEngine()
         e.registerType('simple', TALES.SimpleExpr)
         assert e.getTypes()['simple'] == TALES.SimpleExpr
 
     def testRegisterTypeUnique(self):
-        '''Test expression type registration uniqueness'''
+        # Test expression type registration uniqueness
         e = TALES.ExpressionEngine()
         e.registerType('simple', TALES.SimpleExpr)
         try:
@@ -63,7 +63,7 @@
             assert 0, "Duplicate registration accepted."
 
     def testRegisterTypeNameConstraints(self):
-        '''Test constraints on expression type names'''
+        # Test constraints on expression type names
         e = TALES.ExpressionEngine()
         for name in '1A', 'A!', 'AB ':
             try:
@@ -74,7 +74,7 @@
                 assert 0, 'Invalid type name "%s" accepted.' % name
 
     def testCompile(self):
-        '''Test expression compilation'''
+        # Test expression compilation
         e = TALES.ExpressionEngine()
         e.registerType('simple', TALES.SimpleExpr)
         ce = e.compile('simple:x')
@@ -82,7 +82,7 @@
             'Improperly compiled expression %s.' % `ce`)
 
     def testGetContext(self):
-        '''Test Context creation'''
+        # Test Context creation
         TALES.ExpressionEngine().getContext()
         TALES.ExpressionEngine().getContext(v=1)
         TALES.ExpressionEngine().getContext(x=1, y=2)
@@ -93,13 +93,13 @@
         return apply(e.getContext, (), kws)
 
     def testContext0(self):
-        '''Test use of Context'''
+        # Test use of Context
         se = self.getContext().evaluate('simple:x')
         assert se == ('simple', 'x'), (
             'Improperly evaluated expression %s.' % `se`)
 
     def testVariables(self):
-        '''Test variables'''
+        # Test variables
         ctxt = self.getContext()
         c = ctxt.vars
         ctxt.beginScope()
@@ -107,7 +107,7 @@
         ctxt.setLocal('v2', 2)
 
         assert c['v1'] == 1, 'Variable "v1"'
-        
+
         ctxt.beginScope()
         ctxt.setLocal('v1', 3)
         ctxt.setGlobal('g', 1)
@@ -122,9 +122,11 @@
         assert c['g'] == 1, "Global from inner scope"
 
         ctxt.endScope()
-        
+
+
 def test_suite():
     return unittest.makeSuite(TALESTests)
 
-if __name__=='__main__':
+
+if __name__ == '__main__':
     unittest.TextTestRunner().run(test_suite())