ID EN
Unittest

assertRegex

Python 3.11

Test that a regex search matches (or does not match) text. In case of failure, the error message will include the pattern and the text (or the pattern and the part of text that unexpectedly matched). regex may be a regular expression object or a string containing a regular expression suitable for use by re.search().

Syntax

PYTHON
assertRegex(text, regex, msg=None)

See Also

re.search() assertRegex() assertNotRegex() assertNotRegex()