summaryrefslogtreecommitdiff
path: root/bs4/testing.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2015-06-24 17:03:40 -0400
committerLeonard Richardson <leonardr@segfault.org>2015-06-24 17:03:40 -0400
commit1d4d77e815a33fc0cafd83f9243f0e6626f59add (patch)
treea9329913264eb90b0a9e7cd90b870c6a5f400298 /bs4/testing.py
parent5995aa450c78dd8c078df3176703f98cd51c780d (diff)
downloadbeautifulsoup4-1d4d77e815a33fc0cafd83f9243f0e6626f59add.tar.gz
If the initial <html> tag contains a CDATA list attribute such as
'class', the html5lib tree builder will now turn its value into a list, as it would with any other tag. [bug=1296481]
Diffstat (limited to 'bs4/testing.py')
-rw-r--r--bs4/testing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bs4/testing.py b/bs4/testing.py
index dfaa047..8ca3878 100644
--- a/bs4/testing.py
+++ b/bs4/testing.py
@@ -243,6 +243,14 @@ Hello, world!
soup = self.soup(markup)
self.assertEqual(["css"], soup.div.div['class'])
+ def test_multivalued_attribute_on_html(self):
+ # html5lib uses a different API to set the attributes ot the
+ # <html> tag. This has caused problems with multivalued
+ # attributes.
+ markup = '<html class="a b"></html>'
+ soup = self.soup(markup)
+ self.assertEqual(["a", "b"], soup.html['class'])
+
def test_angle_brackets_in_attribute_values_are_escaped(self):
self.assertSoupEquals('<a b="<a>"></a>', '<a b="&lt;a&gt;"></a>')