diff options
author | Leonard Richardson <leonardr@segfault.org> | 2023-01-25 14:50:44 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2023-01-25 14:50:44 -0500 |
commit | 9f29d5b62539d8020b3e99e084c52a45996b7403 (patch) | |
tree | f0b475ecbbf521c8716e7cd9676b4aa34169d8d2 /bs4/tests/test_tree.py | |
parent | e4f967730af7d5ea59f6a05d03c779df16a24bd3 (diff) |
Passing a Tag's .contents into PageElement.extend() now works the
same way as passing the Tag itself.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r-- | bs4/tests/test_tree.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index bfd6826..f40e764 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -910,12 +910,16 @@ class TestTreeModification(SoupTest): soup.a.extend(l) assert "<a><g></g><f></f><e></e><d></d><c></c><b></b></a>" == soup.decode() - def test_extend_with_another_tags_contents(self): + @pytest.mark.parametrize( + "get_tags", [lambda tag: tag, lambda tag: tag.contents] + ) + def test_extend_with_another_tags_contents(self, tags): data = '<body><div id="d1"><a>1</a><a>2</a><a>3</a><a>4</a></div><div id="d2"></div></body>' soup = self.soup(data) d1 = soup.find('div', id='d1') d2 = soup.find('div', id='d2') - d2.extend(d1) + tags = get_tags(d1) + d2.extend(tags) assert '<div id="d1"></div>' == d1.decode() assert '<div id="d2"><a>1</a><a>2</a><a>3</a><a>4</a></div>' == d2.decode() |