diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-15 08:05:46 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-15 08:05:46 -0500 |
commit | 15f9dc784c352f2928c19460107095651f6fb624 (patch) | |
tree | e1f9d8c5dbd1fee488bf19b31defd87dd9925194 | |
parent | a9e46f36a1dfd3442c484c30db416c0760343968 (diff) |
Tested that extract() distinguishes between idientical strings.
-rw-r--r-- | TODO.txt | 4 | ||||
-rw-r--r-- | bs4/tests/test_tree.py | 17 |
2 files changed, 21 insertions, 0 deletions
@@ -6,6 +6,10 @@ Bugs * html5lib doesn't support SoupStrainers, which is OK, but there should be a warning about it. +* HTML5 defines more multivalue attributes: iframe.sandbox, + output.for, icon.sizes, *.accesskey, *.dropzone, td.headers, + th.headers, a.rel, area.rel, link.rel, *.class, form.accept-charset + Big features ------------ diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index 511d907..4da6fd9 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -879,6 +879,23 @@ class TestTreeModification(SoupTest): self.assertEqual(content_2.previous_element, content_1) self.assertEqual(content_2.previous_sibling, content_1) + def test_extract_distinguishes_between_identical_strings(self): + soup = self.soup("<a>foo</a><b>bar</b>") + foo_1 = soup.a.string + bar_1 = soup.b.string + foo_2 = soup.new_string("foo") + bar_2 = soup.new_string("bar") + soup.a.append(foo_2) + soup.b.append(bar_2) + + # Now there are two identical strings in the <a> tag, and two + # in the <b> tag. Let's remove the first "foo" and the second + # "bar". + foo_1.extract() + bar_2.extract() + self.assertEqual(foo_2, soup.a.string) + self.assertEqual(bar_2, soup.b.string) + def test_clear(self): """Tag.clear()""" soup = self.soup("<p><a>String <em>Italicized</em></a> and another</p>") |