2018-10-31 03:15:03 +08:00
|
|
|
A warning is now issued when assertions are made directly against ``None``.
|
|
|
|
|
|
|
|
This is a common source of confusion among new users, which write::
|
|
|
|
|
|
|
|
assert mocked_object.assert_called_with(3, 4, 5, key='value')
|
2018-11-05 16:13:37 +08:00
|
|
|
|
|
|
|
When they should write::
|
2018-10-31 03:15:03 +08:00
|
|
|
|
|
|
|
mocked_object.assert_called_with(3, 4, 5, key='value')
|
|
|
|
|
|
|
|
Because the ``assert_called_with`` method of mock objects already executes an assertion.
|
2018-11-05 16:13:37 +08:00
|
|
|
|
|
|
|
This warning will not be issued when ``None`` is explicitly checked
|
|
|
|
assert none_returning_fun() is None
|
|
|
|
|
|
|
|
will not issue the warning
|