From d89c8878ea86a2575c87e9fad8081cfcd81e0bcd Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Thu, 10 Feb 2011 16:41:10 -0500 Subject: Added some elementary doctype handling. --- tests/test_html5lib.py | 6 ++++++ tests/test_lxml.py | 11 +++++++++++ 2 files changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/test_html5lib.py b/tests/test_html5lib.py index 3e35949..dada900 100644 --- a/tests/test_html5lib.py +++ b/tests/test_html5lib.py @@ -43,6 +43,8 @@ class TestHTML5Builder(TestLXMLBuilder): self.assertSoupEquals("

") self.assertSoupEquals(" ") + def test_cdata(self): + print self.soup("
") class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup): """See `BuilderInvalidMarkupSmokeTest`.""" @@ -70,6 +72,10 @@ class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup): ('
' '
')) + def test_doctype_in_body(self): + markup = "

onetwo

" + self.assertSoupEquals(markup, "

onetwo

") + def test_foo(self): isolatin = """Sacr\xe9 bleu!""" soup = self.soup(isolatin) diff --git a/tests/test_lxml.py b/tests/test_lxml.py index 2af952f..9a65f6a 100644 --- a/tests/test_lxml.py +++ b/tests/test_lxml.py @@ -198,6 +198,14 @@ class TestLXMLBuilder(SoupTest): # Tests below this line need work. + #def test_doctype(self): + # xml = 'foo

' + # self.assertSoupEquals(xml) + + + #def test_cdata(self): + # print self.soup("
") + def test_entities_converted_on_the_way_out(self): text = "

<<sacré bleu!>>

" expected = u"<<sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!>>".encode("utf-8") @@ -261,4 +269,7 @@ class TestLXMLBuilderInvalidMarkup(SoupTest): '
', '
') + def test_doctype_in_body(self): + markup = "

onetwo

" + self.assertSoupEquals(markup) -- cgit v1.2.3