summaryrefslogtreecommitdiff
path: root/bs4/tests/test_tree.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2023-01-27 20:16:08 -0500
committerLeonard Richardson <leonardr@segfault.org>2023-01-27 20:16:08 -0500
commita65a97e91ce9628bf0001fa40b5dc591288293c9 (patch)
treef5c6fb4e5dec49e77e64e480e349975e77003e89 /bs4/tests/test_tree.py
parent5d4b8486b096aae9605d29774038107f01ecad65 (diff)
Parametrize the 'string is deprecated' warning test so we can test all of the relevant methods.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r--bs4/tests/test_tree.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py
index 0c49cb4..dcd06ab 100644
--- a/bs4/tests/test_tree.py
+++ b/bs4/tests/test_tree.py
@@ -1276,12 +1276,19 @@ class TestTreeModification(SoupTest):
class TestDeprecatedArguments(SoupTest):
- def test_find_type_method_string(self):
+ @pytest.mark.parametrize(
+ "method_name", [
+ "find", "find_all", "find_parent", "find_parents",
+ "find_next", "find_all_next", "find_previous",
+ "find_all_previous", "find_next_sibling", "find_next_siblings",
+ "find_previous_sibling", "find_previous_siblings",
+ ]
+ )
+ def test_find_type_method_string(self, method_name):
soup = self.soup("<a>some</a><b>markup</b>")
+ method = getattr(soup.b, method_name)
with warnings.catch_warnings(record=True) as w:
- [result] = soup.find_all(text='markup')
- assert result == 'markup'
- assert result.parent.name == 'b'
+ method(text='markup')
[warning] = w
assert warning.filename == __file__
msg = str(warning.message)