@@ -76,7 +76,7 @@
themselves output the element they match, avoiding recursion is even
more complex, but should work.
"""
- tmpl = Template('''
+ tmpl = Template("""
${select('*/*')}
@@ -88,7 +88,7 @@
Foo
- ''')
+ """)
self.assertEqual("""
Foo
@@ -97,6 +97,26 @@
""", str(tmpl.generate()))
+class StripDirectiveTestCase(unittest.TestCase):
+ """Tests for the `py:strip` template directive."""
+
+ def test_strip_false(self):
+ tmpl = Template("""
""")
+ self.assertEqual("""
""", str(tmpl.generate()))
+
+ def test_strip_empty(self):
+ tmpl = Template("""
""")
+ self.assertEqual("""
+ foo
+
""", str(tmpl.generate()))
+
+
class TemplateTestCase(unittest.TestCase):
"""Tests for basic template processing, expression evaluation and error
reporting.
@@ -186,6 +206,7 @@
suite.addTest(doctest.DocTestSuite(Template.__module__))
suite.addTest(unittest.makeSuite(TemplateTestCase, 'test'))
suite.addTest(unittest.makeSuite(MatchDirectiveTestCase, 'test'))
+ suite.addTest(unittest.makeSuite(StripDirectiveTestCase, 'test'))
return suite
if __name__ == '__main__':