From 9f437ea591aeaf16d593350baf081315e56a8b73 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 20 Feb 2011 09:54:22 -0500 Subject: Added a test showing weird behavior when you .insert contents into an empty-element tag. --- tests/test_tree.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/test_tree.py') 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("
") + soup.br.insert(1, "Contents") + self.assertEquals(str(soup.br), "
Contents
") + def test_replace_with(self): soup = self.soup( "

There's no business like show business

") -- cgit v1.2.3