MCPcopy Create free account
hub / github.com/csev/py4e / test_cdata

Method test_cdata

code3/pagerank/bs4/tests/test_tree.py:1559–1567  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1557class TestNavigableStringSubclasses(SoupTest):
1558
1559 def test_cdata(self):
1560 # None of the current builders turn CDATA sections into CData
1561 # objects, but you can create them manually.
1562 soup = self.soup("")
1563 cdata = CData("foo")
1564 soup.insert(1, cdata)
1565 self.assertEqual(str(soup), "<![CDATA[foo]]>")
1566 self.assertEqual(soup.find(text="foo"), "foo")
1567 self.assertEqual(soup.contents[0], "foo")
1568
1569 def test_cdata_is_never_formatted(self):
1570 """Text inside a CData object is passed into the formatter.

Callers

nothing calls this directly

Calls 4

CDataClass · 0.90
soupMethod · 0.45
insertMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected