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

Method test_clear

code3/bs4/tests/test_tree.py:1113–1125  ·  view source on GitHub ↗

Tag.clear()

(self)

Source from the content-addressed store, hash-verified

1111
1112
1113 def test_clear(self):
1114 """Tag.clear()"""
1115 soup = self.soup("<p><a>String <em>Italicized</em></a> and another</p>")
1116 # clear using extract()
1117 a = soup.a
1118 soup.p.clear()
1119 self.assertEqual(len(soup.p.contents), 0)
1120 self.assertTrue(hasattr(a, "contents"))
1121
1122 # clear using decompose()
1123 em = a.em
1124 a.clear(decompose=True)
1125 self.assertEqual(0, len(em.contents))
1126
1127 def test_string_set(self):
1128 """Tag.string = 'string'"""

Callers

nothing calls this directly

Calls 2

soupMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected