Skip to content

Commit 984cb72

Browse files
committed
Add "self.assert_in()" and "self.assert_not_in()"
1 parent 32bd8f8 commit 984cb72

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

help_docs/method_summary.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ self.assert_equal(first, second, msg=None)
350350

351351
self.assert_not_equal(first, second, msg=None)
352352

353+
self.assert_in(first, second, msg=None)
354+
355+
self.assert_not_in(first, second, msg=None)
356+
353357
self.assert_raises(*args, **kwargs)
354358

355359
self.wait_for_attribute(

seleniumbase/fixtures/base_case.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3762,6 +3762,16 @@ def assert_not_equal(self, first, second, msg=None):
37623762
Will raise an exception if the values are equal."""
37633763
self.assertNotEqual(first, second, msg=msg)
37643764

3765+
def assert_in(self, first, second, msg=None):
3766+
"""Asserts that the first string is in the second string.
3767+
Will raise an exception if the first string is not in the second."""
3768+
self.assertIn(first, second, msg=msg)
3769+
3770+
def assert_not_in(self, first, second, msg=None):
3771+
"""Asserts that the first string is not in the second string.
3772+
Will raise an exception if the first string is in the second string."""
3773+
self.assertNotIn(first, second, msg=msg)
3774+
37653775
def assert_raises(self, *args, **kwargs):
37663776
"""Asserts that the following block of code raises an exception.
37673777
Will raise an exception if the block of code has no exception.

0 commit comments

Comments
 (0)