| 1 | #!/usr/bin/env python |
|---|
| 2 | |
|---|
| 3 | import unittest |
|---|
| 4 | |
|---|
| 5 | from genshi.template import MarkupTemplate |
|---|
| 6 | |
|---|
| 7 | tmpl_data = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
|---|
| 8 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|---|
| 9 | <html xmlns="http://www.w3.org/1999/xhtml" |
|---|
| 10 | xmlns:py="http://genshi.edgewall.org/"> |
|---|
| 11 | |
|---|
| 12 | <py:match path="body" once="true" buffer="false"> |
|---|
| 13 | <body> |
|---|
| 14 | <div id="banner"> |
|---|
| 15 | This is the original text in ticket |
|---|
| 16 | </div> |
|---|
| 17 | </body> |
|---|
| 18 | </py:match> |
|---|
| 19 | |
|---|
| 20 | <body> |
|---|
| 21 | </body> |
|---|
| 22 | </html>""" |
|---|
| 23 | |
|---|
| 24 | class TestInvalidXml(unittest.TestCase): |
|---|
| 25 | def test_invalid_xml(self): |
|---|
| 26 | tmpl = MarkupTemplate(tmpl_data) |
|---|
| 27 | output = tmpl.generate().render('xhtml', doctype='xhtml') |
|---|
| 28 | print output |
|---|
| 29 | from xml.dom.minidom import parseString |
|---|
| 30 | parseString(output) |
|---|
| 31 | |
|---|
| 32 | |
|---|