diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 10:39:56 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 10:39:56 -0500 |
commit | 232311a2f682e59078012e5b05e382982862f627 (patch) | |
tree | 60bd21949b54bdb5588ecce31a3bb89e40617692 /tests/test_tree.py | |
parent | ae349fd47c627f8166526fed8906811707d2f4b2 (diff) | |
parent | f2532b1d63bd4a4d2be6ad9a4dce5eea03f43e7a (diff) |
I couldn't get the XML parser to parse CDATA as CData objects, but at least I documented the current behavior.
Diffstat (limited to 'tests/test_tree.py')
-rw-r--r-- | tests/test_tree.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test_tree.py b/tests/test_tree.py index 40643dc..6f00716 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -13,7 +13,7 @@ import copy import cPickle as pickle import re from beautifulsoup import BeautifulSoup -from beautifulsoup.element import SoupStrainer, Tag +from beautifulsoup.element import CData, SoupStrainer, Tag from beautifulsoup.testing import SoupTest class TreeTest(SoupTest): @@ -883,9 +883,15 @@ class TestEncoding(SoupTest): soup.b.encode("utf-8"), html.encode("utf-8")) -class TestEmptyElementTags(SoupTest): +class TestNavigableStringSubclasses(SoupTest): - @property - def default_builder(self): - return LXMLTreeBuilderForXML() + def test_cdata(self): + # None of the current builders turn CDATA sections into CData + # objects, but you can create them manually. + soup = self.soup("") + cdata = CData("foo") + soup.insert(1, cdata) + self.assertEquals(str(soup), "<![CDATA[foo]]>") + self.assertEquals(soup.find(text="foo"), "foo") + self.assertEquals(soup.contents[0], "foo") |