summaryrefslogtreecommitdiff
path: root/bs4/tests/test_tree.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-01 11:24:28 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-01 11:24:28 -0500
commit713817f97c12a0eaa331eadef2277f058159aebd (patch)
tree9294bad0c0a9ab4744888a8e9535ee736f557518 /bs4/tests/test_tree.py
parent342fbb95061e21cfda550f41b4faef7e3d569077 (diff)
Added tag creation and string generators, both created while writing the docs.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r--bs4/tests/test_tree.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py
index f8a55e0..ee52edf 100644
--- a/bs4/tests/test_tree.py
+++ b/bs4/tests/test_tree.py
@@ -534,6 +534,17 @@ class TestPreviousSibling(SiblingTest):
self.assertEqual(start.find_previous_sibling(text="nonesuch"), None)
+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")
+ self.assertTrue(isinstance(new_tag, Tag))
+ self.assertEqual("foo", new_tag)
+ self.assertEqual(dict(bar="baz"), new_tag.attrs)
+ self.assertEqual(None, new_tag.parent)
+
+
class TestTreeModification(SoupTest):
def test_attribute_modification(self):