MCPcopy Index your code
hub / github.com/csev/py4e / test_cdata

Method test_cdata

code3/bs4/tests/test_tree.py:1585–1593  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1583class TestNavigableStringSubclasses(SoupTest):
1584
1585 def test_cdata(self):
1586 # None of the current builders turn CDATA sections into CData
1587 # objects, but you can create them manually.
1588 soup = self.soup("")
1589 cdata = CData("foo")
1590 soup.insert(1, cdata)
1591 self.assertEqual(str(soup), "<![CDATA[foo]]>")
1592 self.assertEqual(soup.find(text="foo"), "foo")
1593 self.assertEqual(soup.contents[0], "foo")
1594
1595 def test_cdata_is_never_formatted(self):
1596 """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