[Zope3-checkins] SVN: Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py add two tests for the interaction of on-error handlers and macros; one

Fred L. Drake, Jr. fdrake at gmail.com
Mon Mar 13 18:14:57 EST 2006


Log message for revision 65986:
  add two tests for the interaction of on-error handlers and macros; one
  (disabled) does not yet pass
  

Changed:
  U   Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py

-=-
Modified: Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py	2006-03-13 23:13:59 UTC (rev 65985)
+++ Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py	2006-03-13 23:14:56 UTC (rev 65986)
@@ -126,7 +126,45 @@
         expect = util.read_output('dtml3.html')
         util.check_xml(expect, o)
 
+    def _test_on_error_in_slot_filler(self):
+        # The here/xxx isn't defined, so the macro definition is
+        # expected to catch the error that gets raised.
+        text = '''\
+            <div metal:define-macro="foo">
+               <div tal:on-error="string:eek">
+                  <div metal:define-slot="slot" />
+                  cool
+               </div>
+            </div>
 
+            <div metal:use-macro="template/macros/foo">
+               <div metal:fill-slot="slot">
+                  <p tal:content="here/xxx" />
+               </div>
+            </div>
+            '''
+        self.t.write(text)
+        self.t()
+
+    def test_on_error_in_slot_default(self):
+        # The here/xxx isn't defined, so the macro definition is
+        # expected to catch the error that gets raised.
+        text = '''\
+            <div metal:define-macro="foo">
+               <div tal:on-error="string:eek">
+                  <div metal:define-slot="slot">
+                    <div tal:content="here/xxx" />
+                  </div>
+               </div>
+            </div>
+
+            <div metal:use-macro="template/macros/foo">
+            </div>
+            '''
+        self.t.write(text)
+        self.t()
+
+
 def test_suite():
     return unittest.makeSuite(BasicTemplateTests)
 



More information about the Zope3-Checkins mailing list