Docs
This commit is contained in:
parent
a74243a028
commit
6e510636c1
|
@ -843,6 +843,13 @@ def raises( # noqa: F811
|
||||||
>>> with pytest.raises(ValueError, match=r'must be \d+$'):
|
>>> with pytest.raises(ValueError, match=r'must be \d+$'):
|
||||||
... raise ValueError("value must be 42")
|
... raise ValueError("value must be 42")
|
||||||
|
|
||||||
|
The ``match`` argument searches the formatted exception string, which includes any ``__notes__``:
|
||||||
|
|
||||||
|
>>> with pytest.raises(ValueError, match=r'had a note added'): # doctest: +SKIP
|
||||||
|
... e = ValueError("value must be 42")
|
||||||
|
... e.add_note("had a note added")
|
||||||
|
... raise e
|
||||||
|
|
||||||
The context manager produces an :class:`ExceptionInfo` object which can be used to inspect the
|
The context manager produces an :class:`ExceptionInfo` object which can be used to inspect the
|
||||||
details of the captured exception::
|
details of the captured exception::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue