Fix documentation of pytest.raises(match=...)
This commit is contained in:
parent
ee52a8a5f8
commit
b27e40cbf1
|
@ -564,10 +564,11 @@ class ExceptionInfo(object):
|
||||||
|
|
||||||
def match(self, regexp):
|
def match(self, regexp):
|
||||||
"""
|
"""
|
||||||
Match the regular expression 'regexp' on the string representation of
|
Check whether the regular expression 'regexp' is found in the string
|
||||||
the exception. If it matches then True is returned (so that it is
|
representation of the exception using ``re.search``. If it matches
|
||||||
possible to write 'assert excinfo.match()'). If it doesn't match an
|
then True is returned (so that it is possible to write
|
||||||
AssertionError is raised.
|
``assert excinfo.match()``). If it doesn't match an AssertionError is
|
||||||
|
raised.
|
||||||
"""
|
"""
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
if not re.search(regexp, str(self.value)):
|
if not re.search(regexp, str(self.value)):
|
||||||
|
|
|
@ -559,7 +559,7 @@ def raises(expected_exception, *args, **kwargs):
|
||||||
|
|
||||||
:kwparam match: if specified, a string containing a regular expression,
|
:kwparam match: if specified, a string containing a regular expression,
|
||||||
or a regular expression object, that is tested against the string
|
or a regular expression object, that is tested against the string
|
||||||
representation of the exception using ``re.match``. To match a literal
|
representation of the exception using ``re.search``. To match a literal
|
||||||
string that may contain `special characters`__, the pattern can
|
string that may contain `special characters`__, the pattern can
|
||||||
first be escaped with ``re.escape``.
|
first be escaped with ``re.escape``.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue