mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Closes issue 15323. Improve failure message of Mock.assert_called_once_with
This commit is contained in:
parent
494502756e
commit
28d591ceef
4 changed files with 13 additions and 4 deletions
|
@ -276,7 +276,7 @@ the `new_callable` argument to `patch`.
|
|||
>>> mock.assert_called_once_with('foo', bar='baz')
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
AssertionError: Expected to be called once. Called 2 times.
|
||||
AssertionError: Expected 'mock' to be called once. Called 2 times.
|
||||
|
||||
|
||||
.. method:: assert_any_call(*args, **kwargs)
|
||||
|
@ -2020,7 +2020,7 @@ extremely handy: :meth:`~Mock.assert_called_with` and
|
|||
>>> mock.assert_called_once_with(1, 2, 3)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
AssertionError: Expected to be called once. Called 2 times.
|
||||
AssertionError: Expected 'mock' to be called once. Called 2 times.
|
||||
|
||||
Because mocks auto-create attributes on demand, and allow you to call them
|
||||
with arbitrary arguments, if you misspell one of these assert methods then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue