diff options
author | Leonard Richardson <leonardr@segfault.org> | 2018-07-15 20:04:03 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2018-07-15 20:04:03 -0400 |
commit | 75c81928902b3f2896cbd3482a59828965627916 (patch) | |
tree | d20036348c7aecb0309e6b362f211d65b340db03 /bs4/tests/test_tree.py | |
parent | a98b0e4b7cd1d0c61eebc50efabc6bc7876b50a0 (diff) |
You can pass a dictionary of into
BeautifulSoup.new_tag. This makes it possible to create a tag with
an attribute like 'name' that would otherwise be masked by another
argument of new_tag. [bug=1779276]
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r-- | bs4/tests/test_tree.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index e8903e3..e5cc47e 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -703,12 +703,12 @@ class TestTagCreation(SoupTest): """Test the ability to create new tags.""" def test_new_tag(self): soup = self.soup("") - new_tag = soup.new_tag("foo", bar="baz") + new_tag = soup.new_tag("foo", bar="baz", attrs={"name": "a name"}) self.assertTrue(isinstance(new_tag, Tag)) self.assertEqual("foo", new_tag.name) - self.assertEqual(dict(bar="baz"), new_tag.attrs) + self.assertEqual(dict(bar="baz", name="a name"), new_tag.attrs) self.assertEqual(None, new_tag.parent) - + def test_tag_inherits_self_closing_rules_from_builder(self): if XML_BUILDER_PRESENT: xml_soup = BeautifulSoup("", "lxml-xml") |