comparison markup/tests/template.py @ 165:54a4be707664 trunk

Fix handling of keyword arguments in `py:def` directive. Thanks to Christian Boos for reporting the problem and providing the basic patch for this change.
author cmlenz
date Thu, 17 Aug 2006 14:02:58 +0000
parents 3f23fafeef99
children d43f50402cf2
comparison
equal deleted inserted replaced
164:1f6cb675a66c 165:54a4be707664
200 ${echo('foo')} 200 ${echo('foo')}
201 </doc>""") 201 </doc>""")
202 self.assertEqual("""<doc> 202 self.assertEqual("""<doc>
203 <strong>foo</strong> 203 <strong>foo</strong>
204 </doc>""", str(tmpl.generate(semantic=True))) 204 </doc>""", str(tmpl.generate(semantic=True)))
205
206 def test_function_with_default_arg(self):
207 """
208 Verify that keyword arguments work with `py:def` directives.
209 """
210 tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/">
211 <b py:def="echo(what, bold=False)" py:strip="not bold">${what}</b>
212 ${echo('foo')}
213 </doc>""")
214 self.assertEqual("""<doc>
215 foo
216 </doc>""", str(tmpl.generate()))
205 217
206 218
207 class ForDirectiveTestCase(unittest.TestCase): 219 class ForDirectiveTestCase(unittest.TestCase):
208 """Tests for the `py:for` template directive.""" 220 """Tests for the `py:for` template directive."""
209 221
Copyright (C) 2012-2017 Edgewall Software