diff options
author | Leonard Richardson <leonardr@segfault.org> | 2012-05-24 08:28:14 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2012-05-24 08:28:14 -0400 |
commit | 7f050e858f8f2ee084b4e6f7ed69fc97de4360da (patch) | |
tree | 296720ecccc857c5e7ac54665a6e65f13b894265 /bs4/testing.py | |
parent | 2309fc6b6148d86e6f6e04471956e2bbae4aadd3 (diff) | |
download | beautifulsoup4-7f050e858f8f2ee084b4e6f7ed69fc97de4360da.tar.gz |
Fixed a bug with the lxml treebuilder that prevented the user from adding attributes to a tag that didn't originally have any. [bug=1002378] Thanks to Oliver Beattie for the patch.
Diffstat (limited to 'bs4/testing.py')
-rw-r--r-- | bs4/testing.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bs4/testing.py b/bs4/testing.py index 40dc976..5a84b0b 100644 --- a/bs4/testing.py +++ b/bs4/testing.py @@ -421,6 +421,11 @@ class HTMLTreeBuilderSmokeTest(object): # encoding. self.assertEqual('utf8', charset.encode("utf8")) + def test_tag_with_no_attributes_can_have_attributes_added(self): + data = self.soup("<a>text</a>") + data.a['foo'] = 'bar' + self.assertEqual('<a foo="bar">text</a>', data.a.decode()) + class XMLTreeBuilderSmokeTest(object): def test_docstring_generated(self): |