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
commit3541d3382be957274fec29a699595dd7a348c390 (patch)
tree8e6186e9fafaf9db0eef26ad532a99ca1a2320a7 /bs4/testing.py
parent29f97ad45bfd4a0d1a6b5359b4c10ac9e26a87d5 (diff)
downloadbeautifulsoup4-3541d3382be957274fec29a699595dd7a348c390.tar.gz
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>"