>>> mock = Mock(name='Thing', return_value=None)
>>> mock(1, 2, 3)
- >>> mock.assret_called_once_with(4, 5, 6)
+ >>> mock.assret_called_once_with(4, 5, 6) # Intentional typo!
Your tests can pass silently and incorrectly because of the typo.
>>> from urllib import request
>>> mock = Mock(spec=request.Request)
- >>> mock.assret_called_with
+ >>> mock.assret_called_with # Intentional typo!
Traceback (most recent call last):
...
AttributeError: Mock object has no attribute 'assret_called_with'
>>> mock.has_data()
<mock.Mock object at 0x...>
- >>> mock.has_data.assret_called_with()
+ >>> mock.has_data.assret_called_with() # Intentional typo!
Auto-speccing solves this problem. You can either pass ``autospec=True`` to
:func:`patch` / :func:`patch.object` or use the :func:`create_autospec` function to create a
>>> req.add_header('spam', 'eggs')
<MagicMock name='request.Request().add_header()' id='...'>
- >>> req.add_header.assret_called_with
+ >>> req.add_header.assret_called_with # Intentional typo!
Traceback (most recent call last):
...
AttributeError: Mock object has no attribute 'assret_called_with'