MCPcopy
hub / github.com/csev/py4e / test_replace_final_node

Method test_replace_final_node

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

Source from the content-addressed store, hash-verified

824 self.assertEqual("three", soup.b.string)
825
826 def test_replace_final_node(self):
827 soup = self.soup("<b>Argh!</b>")
828 soup.find(text="Argh!").replace_with("Hooray!")
829 new_text = soup.find(text="Hooray!")
830 b = soup.b
831 self.assertEqual(new_text.previous_element, b)
832 self.assertEqual(new_text.parent, b)
833 self.assertEqual(new_text.previous_element.next_element, new_text)
834 self.assertEqual(new_text.next_element, None)
835
836 def test_consecutive_text_nodes(self):
837 # A builder should never create two consecutive text nodes,

Callers

nothing calls this directly

Calls 3

soupMethod · 0.45
replace_withMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected