Skip to content

Commit

Permalink
Adjustments to assert raises docs (#11586)
Browse files Browse the repository at this point in the history
Followup from #11578.
  • Loading branch information
nicoddemus authored Nov 4, 2023
1 parent 1e02797 commit 70f03db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/en/how-to/assert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ If you want to check if a block of code is raising an exact exception type, you

.. code-block:: python
def test_recursion_depth():
def test_foo_not_implemented():
def foo():
raise NotImplementedError
with pytest.raises(RuntimeError) as excinfo:
foo()
assert type(excinfo.value) is RuntimeError
assert excinfo.type is RuntimeError
The :func:`pytest.raises` call will succeed, even though the function raises :class:`NotImplementedError`, because
:class:`NotImplementedError` is a subclass of :class:`RuntimeError`; however the following `assert` statement will
Expand Down

0 comments on commit 70f03db

Please sign in to comment.