summaryrefslogtreecommitdiff
path: root/bs4/tests/__init__.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2021-10-11 14:29:27 -0400
committerLeonard Richardson <leonardr@segfault.org>2021-10-11 14:29:27 -0400
commitcf371d4ab99860d96b97b355d5c01a45013f9c42 (patch)
tree316e8e184b6666c71f1baeb97e71b2b598eb920f /bs4/tests/__init__.py
parent535d047aef8edcf2aed517cd883f4ba95b298bd8 (diff)
Broke up some monolithic unit test files.
Diffstat (limited to 'bs4/tests/__init__.py')
-rw-r--r--bs4/tests/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/bs4/tests/__init__.py b/bs4/tests/__init__.py
index 97914c0..6b70c34 100644
--- a/bs4/tests/__init__.py
+++ b/bs4/tests/__init__.py
@@ -230,6 +230,24 @@ class SoupTest(object):
# Return the child to the recursive caller
return child
+ def assert_selects(self, tags, should_match):
+ """Make sure that the given tags have the correct text.
+
+ This is used in tests that define a bunch of tags, each
+ containing a single string, and then select certain strings by
+ some mechanism.
+ """
+ assert [tag.string for tag in tags] == should_match
+
+ def assert_selects_ids(self, tags, should_match):
+ """Make sure that the given tags have the correct IDs.
+
+ This is used in tests that define a bunch of tags, each
+ containing a single string, and then select certain strings by
+ some mechanism.
+ """
+ assert [tag['id'] for tag in tags] == should_match
+
class TreeBuilderSmokeTest(object):
# Tests that are common to HTML and XML tree builders.