[Zope3-checkins] CVS: Zope3/src/zope/documenttemplate/tests - dtmltestbase.py:1.1.2.2 testdt_if.py:1.1.2.2 testdt_in.py:1.1.2.2 testdt_try.py:1.1.2.2 testdt_var.py:1.1.2.2 testdt_with.py:1.1.2.2

Tim Peters tim.one@comcast.net
Tue, 24 Dec 2002 21:21:35 -0500


Update of /cvs-repository/Zope3/src/zope/documenttemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/documenttemplate/tests

Modified Files:
      Tag: NameGeddon-branch
	dtmltestbase.py testdt_if.py testdt_in.py testdt_try.py 
	testdt_var.py testdt_with.py 
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py.  The
files are fixed-points of that script now.  Fixed a few cases where
code relied on significant trailing whitespace (ouch).


=== Zope3/src/zope/documenttemplate/tests/dtmltestbase.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/documenttemplate/tests/dtmltestbase.py:1.1.2.1	Mon Dec 23 14:32:47 2002
+++ Zope3/src/zope/documenttemplate/tests/dtmltestbase.py	Tue Dec 24 21:21:02 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 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
-# 
+#
 ##############################################################################
 """Document Template Tests
 


=== Zope3/src/zope/documenttemplate/tests/testdt_if.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/documenttemplate/tests/testdt_if.py:1.1.2.1	Mon Dec 23 14:32:47 2002
+++ Zope3/src/zope/documenttemplate/tests/testdt_if.py	Tue Dec 24 21:21:02 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 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
-# 
+#
 ##############################################################################
 """Document Template Tests
 
@@ -17,14 +17,14 @@
 
 import unittest
 from zope.documenttemplate import String
-from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase 
+from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase
 
 class TestDT_If(DTMLTestBase):
 
 
     def testBasic(self):
 
-        html = self.doc_class(    
+        html = self.doc_class(
             """\
              <dtml-if value>
                The arguments were: <dtml-var value>
@@ -36,11 +36,11 @@
 
         self.assertEqual(html(value='foo').strip(), result1.strip())
         self.assertEqual(html().strip(), result2.strip())
-        
-        
+
+
     def testElse(self):
 
-        html = self.doc_class(    
+        html = self.doc_class(
             """\
              <dtml-if value>
                The arguments were: <dtml-var value>
@@ -56,8 +56,8 @@
         self.assertEqual(html().strip(), result2.strip())
 
     def testElIf(self):
-        
-        html = self.doc_class(    
+
+        html = self.doc_class(
             """\
              <dtml-if value>
                The arguments were: <dtml-var value>
@@ -73,8 +73,8 @@
                          result1.strip())
         self.assertEqual(html(value='', attribute='bar').strip(),
                          result2.strip())
-        
-      
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite(TestDT_If) )


=== Zope3/src/zope/documenttemplate/tests/testdt_in.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/documenttemplate/tests/testdt_in.py:1.1.2.1	Mon Dec 23 14:32:47 2002
+++ Zope3/src/zope/documenttemplate/tests/testdt_in.py	Tue Dec 24 21:21:02 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 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
-# 
+#
 ##############################################################################
 """Document Template Tests
 
@@ -17,7 +17,7 @@
 
 import unittest
 from zope.documenttemplate import String
-from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase, dict, ObjectStub 
+from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase, dict, ObjectStub
 
 class TestDT_In(DTMLTestBase):
 
@@ -93,7 +93,7 @@
         result = self.doc_class(html)(seq=seq, data={})
         self.assertEqual(result, expected)
 
-        
+
     def testStringSyntax(self):
         data=(
             dict(name='jim', age=39),
@@ -118,7 +118,7 @@
         self.assertEqual(result, expected)
 
 
-        
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite(TestDT_In) )


=== Zope3/src/zope/documenttemplate/tests/testdt_try.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/documenttemplate/tests/testdt_try.py:1.1.2.1	Mon Dec 23 14:32:47 2002
+++ Zope3/src/zope/documenttemplate/tests/testdt_try.py	Tue Dec 24 21:21:02 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 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
-# 
+#
 ##############################################################################
 """Document Template Tests
 
@@ -17,7 +17,7 @@
 
 import unittest
 from zope.documenttemplate import String
-from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase 
+from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase
 
 class TestDT_Try(DTMLTestBase):
 
@@ -37,7 +37,7 @@
 
         self.assertEqual(html(value='bar').strip(), result1.strip())
         self.assertEqual(html().strip(), result2.strip())
-      
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite(TestDT_Try))


=== Zope3/src/zope/documenttemplate/tests/testdt_var.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/documenttemplate/tests/testdt_var.py:1.1.2.1	Mon Dec 23 14:32:47 2002
+++ Zope3/src/zope/documenttemplate/tests/testdt_var.py	Tue Dec 24 21:21:02 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 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
-# 
+#
 ##############################################################################
 """Document Template Tests
 
@@ -20,14 +20,14 @@
 
 import unittest
 from zope.documenttemplate import String
-from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase, dict, ObjectStub 
+from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase, dict, ObjectStub
 
 class TestDT_Var(DTMLTestBase):
 
     def testFmt(self):
         html = self.doc_class (
             '''<dtml-var spam fmt="$%.2f bob\'s your uncle"
-                              null="spam%eggs!|">''') 
+                              null="spam%eggs!|">''')
 
         self.assertEqual(html(spam=42), '$42.00 bob\'s your uncle')
         self.assertEqual(html(spam=None), 'spam%eggs!|')
@@ -44,9 +44,9 @@
             cents:    <dtml-var spam fmt=dollars-and-cents>
             dollars,: <dtml-var spam fmt=dollars-with-commas>
             cents,:   <dtml-var spam fmt=dollars-and-cents-with-commas>
-    
+
             """)
-    
+
         result1 = (
             """
                       4200000
@@ -57,33 +57,35 @@
             cents:    $4200000.00
             dollars,: $4,200,000
             cents,:   $4,200,000.00
-    
+
             """)
-    
+
+        # Caution:  Some of these lines have significant trailing whitespace.
+        # Necessary trailing blanks are explicitly forced via \x20.
         result2 = (
             """
                       None
             html:     None
             url:      None
             multi:    None
-            dollars:  
-            cents:    
-            dollars,: 
-            cents,:   
-    
+            dollars:\x20\x20
+            cents:\x20\x20\x20\x20
+            dollars,:\x20
+            cents,:\x20\x20\x20
+
             """)
-        
+
         result3 = (
             """
                       <a href="spam">\nfoo bar
             html:     &lt;a href=&quot;spam&quot;&gt;\nfoo bar
             url:      %3Ca%20href%3D%22spam%22%3E%0Afoo%20bar
             multi:    <a href="spam"><br>\nfoo bar
-            dollars:  
-            cents:    
-            dollars,: 
-            cents,:   
-    
+            dollars:\x20\x20
+            cents:\x20\x20\x20\x20
+            dollars,:\x20
+            cents,:\x20\x20\x20
+
             """)
 
         self.assertEqual(html(spam=4200000), result1)
@@ -92,32 +94,32 @@
 
 
     def testRender(self):
-       # Test automatic rendering of callable objects
-       class C:
-          x = 1
-          def y(self): return self.x * 2
-          h = self.doc_class("The h method, <dtml-var x> <dtml-var y>")
-          h2 = self.doc_class("The h2 method")
-
-       res1 = self.doc_class("<dtml-var x>, <dtml-var y>, <dtml-var h>")(C())
-       res2 = self.doc_class(
-          """
-          <dtml-var expr="_.render(i.x)">,
-          <dtml-var expr="_.render(i.y)">,
-          
-          <dtml-var expr="_.render(i.h2)">""")(i=C())
+        # Test automatic rendering of callable objects
+        class C:
+            x = 1
+            def y(self): return self.x * 2
+            h = self.doc_class("The h method, <dtml-var x> <dtml-var y>")
+            h2 = self.doc_class("The h2 method")
 
-       expected = '1, 2, The h method, 1 2'
-       expected2 = (
+        res1 = self.doc_class("<dtml-var x>, <dtml-var y>, <dtml-var h>")(C())
+        res2 = self.doc_class(
            """
-          1,
-          2,
-          
-          The h2 method""")
-
-       self.assertEqual(res1, expected)
-       self.assertEqual(res2, expected2)
-       
+           <dtml-var expr="_.render(i.x)">,
+           <dtml-var expr="_.render(i.y)">,
+
+           <dtml-var expr="_.render(i.h2)">""")(i=C())
+
+        expected = '1, 2, The h method, 1 2'
+        expected2 = (
+            """
+           1,
+           2,
+
+           The h2 method""")
+
+        self.assertEqual(res1, expected)
+        self.assertEqual(res2, expected2)
+
 
 def test_suite():
     suite = unittest.TestSuite()


=== Zope3/src/zope/documenttemplate/tests/testdt_with.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/documenttemplate/tests/testdt_with.py:1.1.2.1	Mon Dec 23 14:32:47 2002
+++ Zope3/src/zope/documenttemplate/tests/testdt_with.py	Tue Dec 24 21:21:02 2002
@@ -1,14 +1,14 @@
 ##############################################################################
 #
 # Copyright (c) 2001 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
-# 
+#
 ##############################################################################
 """Document Template Tests
 
@@ -16,7 +16,7 @@
 """
 
 import unittest
-from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase 
+from zope.documenttemplate.tests.dtmltestbase import DTMLTestBase
 
 class TestDT_With(DTMLTestBase):
 
@@ -35,7 +35,7 @@
         """
 
         self.assertEqual(result, expected)
-      
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite(TestDT_With) )