summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-15 08:05:46 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-15 08:05:46 -0500
commit15f9dc784c352f2928c19460107095651f6fb624 (patch)
treee1f9d8c5dbd1fee488bf19b31defd87dd9925194
parenta9e46f36a1dfd3442c484c30db416c0760343968 (diff)
Tested that extract() distinguishes between idientical strings.
-rw-r--r--TODO.txt4
-rw-r--r--bs4/tests/test_tree.py17
2 files changed, 21 insertions, 0 deletions
diff --git a/TODO.txt b/TODO.txt
index 2f03dd2..06dd6bc 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -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>")