[Checkins] SVN: five.pt/trunk/src/five/pt/tests/ Adding tests for ``"nocall:"`` and ``"exists:"`` expression types.

Malthe Borch mborch at gmail.com
Thu Mar 24 11:38:35 EDT 2011


Log message for revision 121116:
  Adding tests for ``"nocall:"`` and ``"exists:"`` expression types.

Changed:
  A   five.pt/trunk/src/five/pt/tests/exists.pt
  A   five.pt/trunk/src/five/pt/tests/nocall.pt
  U   five.pt/trunk/src/five/pt/tests/test_basetemplatefile.py

-=-
Added: five.pt/trunk/src/five/pt/tests/exists.pt
===================================================================
--- five.pt/trunk/src/five/pt/tests/exists.pt	                        (rev 0)
+++ five.pt/trunk/src/five/pt/tests/exists.pt	2011-03-24 15:38:35 UTC (rev 121116)
@@ -0,0 +1 @@
+<div tal:condition="exists: options/callable">ok</div>
\ No newline at end of file

Added: five.pt/trunk/src/five/pt/tests/nocall.pt
===================================================================
--- five.pt/trunk/src/five/pt/tests/nocall.pt	                        (rev 0)
+++ five.pt/trunk/src/five/pt/tests/nocall.pt	2011-03-24 15:38:35 UTC (rev 121116)
@@ -0,0 +1 @@
+<div tal:content="structure nocall: options/callable" />
\ No newline at end of file

Modified: five.pt/trunk/src/five/pt/tests/test_basetemplatefile.py
===================================================================
--- five.pt/trunk/src/five/pt/tests/test_basetemplatefile.py	2011-03-24 15:37:34 UTC (rev 121115)
+++ five.pt/trunk/src/five/pt/tests/test_basetemplatefile.py	2011-03-24 15:38:35 UTC (rev 121116)
@@ -19,6 +19,22 @@
         self.failUnless('container==None:True' in result)
         self.failUnless("nothing:" in result)
 
+    def test_nocall(self):
+        template = BaseTemplateFile("nocall.pt")
+
+        def dont_call():
+            raise RuntimeError()
+        result = template(callable=dont_call)
+        self.failUnless(repr(dont_call) in result)
+
+    def test_exists(self):
+        template = BaseTemplateFile("exists.pt")
+
+        def dont_call():
+            raise RuntimeError()
+        result = template(callable=dont_call)
+        self.failUnless('ok' in result)
+
     def test_simple(self):
         template = BaseTemplateFile("simple.pt")
         result = template()



More information about the checkins mailing list