summaryrefslogtreecommitdiff
path: root/tests/test_html5lib.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-13 19:59:44 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-13 19:59:44 -0500
commitbc97bb3a83ee9fb4c8e31d11069ccf1cda61d4ff (patch)
treebf0637e79bc667a1b5ae08ca4794df414f169992 /tests/test_html5lib.py
parenta011baa0e95e3d42d647cdf68164ba1c30314492 (diff)
Added tests of nonsensical declarations.
Diffstat (limited to 'tests/test_html5lib.py')
-rw-r--r--tests/test_html5lib.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_html5lib.py b/tests/test_html5lib.py
index 2d16bbb..48f27ae 100644
--- a/tests/test_html5lib.py
+++ b/tests/test_html5lib.py
@@ -95,6 +95,19 @@ class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup):
data = soup.find(text="[CDATA[foo]]")
self.assertEquals(data.__class__, Comment)
+ def test_nonsensical_declaration(self):
+ # Declarations that don't make any sense are turned into comments.
+ soup = self.soup('<! Foo = -8><p>a</p>')
+ self.assertEquals(str(soup),
+ ("<!-- Foo = -8-->"
+ "<html><head></head><body><p>a</p></body></html>"))
+
+ soup = self.soup('<p>a</p><! Foo = -8>')
+ self.assertEquals(str(soup),
+ ("<html><head></head><body><p>a</p>"
+ "<!-- Foo = -8--></body></html>"))
+
+
def test_foo(self):
isolatin = """<html><meta http-equiv="Content-type" content="text/html; charset=ISO-Latin-1" />Sacr\xe9 bleu!</html>"""
soup = self.soup(isolatin)