24 lines
592 B
ReStructuredText
24 lines
592 B
ReStructuredText
A warning is now issued when assertions are made for ``None``.
|
|
|
|
This is a common source of confusion among new users, which write:
|
|
|
|
.. code-block:: python
|
|
|
|
assert mocked_object.assert_called_with(3, 4, 5, key="value")
|
|
|
|
When they should write:
|
|
|
|
.. code-block:: python
|
|
|
|
mocked_object.assert_called_with(3, 4, 5, key="value")
|
|
|
|
Because the ``assert_called_with`` method of mock objects already executes an assertion.
|
|
|
|
This warning will not be issued when ``None`` is explicitly checked. An assertion like:
|
|
|
|
.. code-block:: python
|
|
|
|
assert variable is None
|
|
|
|
will not issue the warning.
|