Mercurial > genshi > mirror
changeset 292:b72ec37783eb trunk
A couple for unit tests for match templates, including one that currently fails (and is commented out).
author | cmlenz |
---|---|
date | Fri, 13 Oct 2006 09:35:08 +0000 |
parents | b6684c946a53 |
children | e17b7459b515 |
files | genshi/tests/template.py |
diffstat | 1 files changed, 46 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/genshi/tests/template.py +++ b/genshi/tests/template.py @@ -719,6 +719,52 @@ <div>Foo</div> </html>""", str(tmpl.generate())) + def test_match_with_position_predicate(self): + tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> + <p py:match="body/p[1]" class="first">${select('*|text()')}</p> + <body> + <p>Foo</p> + <p>Bar</p> + </body> + </html>""") + self.assertEqual("""<html> + <body> + <p class="first">Foo</p> + <p>Bar</p> + </body> + </html>""", str(tmpl.generate())) + + def test_match_with_closure(self): + tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> + <p py:match="body//p" class="para">${select('*|text()')}</p> + <body> + <p>Foo</p> + <div><p>Bar</p></div> + </body> + </html>""") + self.assertEqual("""<html> + <body> + <p class="para">Foo</p> + <div><p class="para">Bar</p></div> + </body> + </html>""", str(tmpl.generate())) + + # FIXME + #def test_match_without_closure(self): + # tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> + # <p py:match="body/p" class="para">${select('*|text()')}</p> + # <body> + # <p>Foo</p> + # <div><p>Bar</p></div> + # </body> + # </html>""") + # self.assertEqual("""<html> + # <body> + # <p class="para">Foo</p> + # <div><p>Bar</p></div> + # </body> + # </html>""", str(tmpl.generate())) + # FIXME #def test_match_after_step(self): # tmpl = MarkupTemplate("""<div xmlns:py="http://genshi.edgewall.org/">