diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 09:54:22 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-20 09:54:22 -0500 |
commit | 9f437ea591aeaf16d593350baf081315e56a8b73 (patch) | |
tree | 116edd8c1d9a7cf6348f784162fd2291608833c2 /tests/test_tree.py | |
parent | 7dec14806011343d3460a3fa34d7cf88799e8f4c (diff) |
Added a test showing weird behavior when you .insert contents into an empty-element tag.
Diffstat (limited to 'tests/test_tree.py')
-rw-r--r-- | tests/test_tree.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_tree.py b/tests/test_tree.py index 191f614..40643dc 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -620,6 +620,15 @@ class TestTreeModification(SoupTest): self.assertEqual(the.next, c_tag) self.assertEqual(c_tag.previous, the) + def test_insert_works_on_empty_element_tag(self): + # This is a little strange, since most HTML parsers don't allow + # markup like this to come through. But in general, we don't + # know what the parser would or wouldn't have allowed, so + # I'm letting this succeed for now. + soup = self.soup("<br />") + soup.br.insert(1, "Contents") + self.assertEquals(str(soup.br), "<br>Contents</br>") + def test_replace_with(self): soup = self.soup( "<p>There's <b>no</b> business like <b>show</b> business</p>") |