diff genshi/template/tests/directives.py @ 480:2f46ae8deae2 stable-0.4.x

Ported [579] (for #116) to 0.4.x.
author cmlenz
date Mon, 14 May 2007 20:34:51 +0000
parents 57e8bd746717
children d7b957e92ea9 acf7c5ee36e7
line wrap: on
line diff
--- a/genshi/template/tests/directives.py
+++ b/genshi/template/tests/directives.py
@@ -384,6 +384,25 @@
                       Hi, you!
         """, str(tmpl.generate()))
 
+    def test_function_with_star_args(self):
+        """
+        Verify that a named template function using "star arguments" works as
+        expected.
+        """
+        tmpl = MarkupTemplate("""<doc xmlns:py="http://genshi.edgewall.org/">
+          <div py:def="f(*args, **kwargs)">
+            ${repr(args)}
+            ${repr(kwargs)}
+          </div>
+          ${f(1, 2, a=3, b=4)}
+        </doc>""")
+        self.assertEqual("""<doc>
+          <div>
+            [1, 2]
+            {'a': 3, 'b': 4}
+          </div>
+        </doc>""", str(tmpl.generate()))
+
 
 class ForDirectiveTestCase(unittest.TestCase):
     """Tests for the `py:for` template directive."""
Copyright (C) 2012-2017 Edgewall Software