def test_clean_tag_node_disallows_nested_unrecognised_node(self): """ <foo> tags should be removed, even when nested. """ soup = BeautifulSoup('<b><foo>bar</foo></b>', 'html5lib') tag = soup.b Whitelister.clean_tag_node(tag, tag) self.assertEqual(str(tag), '<b>bar</b>')
def test_clean_tag_node_disallows_nested_unrecognised_node(self): """ <foo> tags should be removed, even when nested. """ soup = BeautifulSoup('<b><foo>bar</foo></b>') tag = soup.b Whitelister.clean_tag_node(tag, tag) self.assertEqual(str(tag), '<b>bar</b>')
def test_clean_tag_node_cleans_nested_recognised_node(self): """ <b> tags are allowed without attributes. This remains true when tags are nested. """ soup = BeautifulSoup('<b><b class="delete me">foo</b></b>', 'html5lib') tag = soup.b Whitelister.clean_tag_node(tag, tag) self.assertEqual(str(tag), '<b><b>foo</b></b>')
def test_clean_tag_node_cleans_nested_recognised_node(self): """ <b> tags are allowed without attributes. This remains true when tags are nested. """ soup = BeautifulSoup('<b><b class="delete me">foo</b></b>') tag = soup.b Whitelister.clean_tag_node(tag, tag) self.assertEqual(str(tag), '<b><b>foo</b></b>')