summaryrefslogtreecommitdiff
path: root/bs4/testing.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2015-06-23 19:50:23 -0400
committerLeonard Richardson <leonardr@segfault.org>2015-06-23 19:50:23 -0400
commit81b0e7160db445f9d8fb8bf09ba306df87cac19e (patch)
tree49e28714198e01fbf1c96ff717d3a1bcbf569f20 /bs4/testing.py
parent5bd09164de9b5a45ffea4171968b8186dcdc6f69 (diff)
Force object_was_parsed() to keep the tree intact even when an element
from later in the document is moved into place. [bug=1430633]
Diffstat (limited to 'bs4/testing.py')
-rw-r--r--bs4/testing.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/bs4/testing.py b/bs4/testing.py
index 023a495..a85ecd6 100644
--- a/bs4/testing.py
+++ b/bs4/testing.py
@@ -160,6 +160,23 @@ class HTMLTreeBuilderSmokeTest(object):
def test_nested_formatting_elements(self):
self.assertSoupEquals("<em><em></em></em>")
+ def test_double_head(self):
+ html = '''<!DOCTYPE html>
+<html>
+<head>
+<title>Ordinary HEAD element test</title>
+</head>
+<script type="text/javascript">
+alert("Help!");
+</script>
+<body>
+Hello, world!
+</body>
+</html>
+'''
+ soup = self.soup(html)
+ self.assertEqual("text/javascript", soup.find('script')['type'])
+
def test_comment(self):
# Comments are represented as Comment objects.
markup = "<p>foo<!--foobar-->baz</p>"