[Zope-CVS] CVS: Products/CompositePage/tests - test_composite.py:1.2

Shane Hathaway shane at zope.com
Mon Mar 8 15:03:46 EST 2004


Update of /cvs-repository/Products/CompositePage/tests
In directory cvs.zope.org:/tmp/cvs-serv533/tests

Modified Files:
	test_composite.py 
Log Message:
Slot expressions now use a particular order: "name(class) 'title'"


=== Products/CompositePage/tests/test_composite.py 1.1 => 1.2 ===
--- Products/CompositePage/tests/test_composite.py:1.1	Fri Mar  5 16:41:06 2004
+++ Products/CompositePage/tests/test_composite.py	Mon Mar  8 15:03:45 2004
@@ -21,6 +21,7 @@
 import ZODB
 from OFS.Folder import Folder
 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
+from TAL.TALDefs import TALError
 from Products.CompositePage.slot import Slot
 from Products.CompositePage.composite import Composite
 from Products.CompositePage.element import CompositeElement
@@ -124,6 +125,19 @@
                     '<div class="slot_header"></div><div><b>Slot A</b></div>'
                     '</body></html>')
         self.assertTextEqual(rendered, expected)
+
+    def testSlotExprCompilerError(self):
+        # Bad slot expressions should produce a reasonable error.
+        text = '<div tal:content="structure slot: a b" />'
+        try:
+            t = ZopePageTemplate(
+                id="template", text=text, content_type="text/html")
+        except TALError, e:
+            msg = str(e)
+        else:
+            raise AssertionError("Expected a syntax error")
+        substr = "near ' b'"
+        self.assert_(msg.find(substr) >= 0)
 
 
 if __name__ == "__main__":




More information about the Zope-CVS mailing list