diff options
author | Egil Martinsson <ragulpr@users.noreply.github.com> | 2023-09-15 18:25:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 18:25:16 (GMT) |
commit | 3d881453d32101855cd083ef79641da5e437df3d (patch) | |
tree | 4baa04b02442bb8388a48da98ccb107f57c5cd95 /Doc/library/unittest.mock.rst | |
parent | 92ed7e4df1af84fb29e678d111e8561ffcd14581 (diff) | |
download | cpython-3d881453d32101855cd083ef79641da5e437df3d.zip cpython-3d881453d32101855cd083ef79641da5e437df3d.tar.gz cpython-3d881453d32101855cd083ef79641da5e437df3d.tar.bz2 |
gh-109350: Fix outdated captured output in unittest.mock documentation (#109353)
Diffstat (limited to 'Doc/library/unittest.mock.rst')
-rw-r--r-- | Doc/library/unittest.mock.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index 836fd42..1452276 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -189,7 +189,7 @@ code if they are used incorrectly: >>> mock_function('wrong arguments') Traceback (most recent call last): ... - TypeError: <lambda>() takes exactly 3 arguments (1 given) + TypeError: missing a required argument: 'b' :func:`create_autospec` can also be used on classes, where it copies the signature of the ``__init__`` method, and on callable objects where it copies the signature of @@ -315,6 +315,7 @@ the *new_callable* argument to :func:`patch`. Traceback (most recent call last): ... AssertionError: Expected 'method' to have been called once. Called 2 times. + Calls: [call(), call()]. .. versionadded:: 3.6 @@ -342,7 +343,7 @@ the *new_callable* argument to :func:`patch`. Traceback (most recent call last): ... AssertionError: Expected 'mock' to be called once. Called 2 times. - + Calls: [call('foo', bar='baz'), call('other', bar='values')]. .. method:: assert_any_call(*args, **kwargs) @@ -392,6 +393,7 @@ the *new_callable* argument to :func:`patch`. Traceback (most recent call last): ... AssertionError: Expected 'hello' to not have been called. Called 1 times. + Calls: [call()]. .. versionadded:: 3.5 @@ -954,7 +956,7 @@ object:: >>> asyncio.run(main()) >>> mock.assert_awaited_once() >>> asyncio.run(main()) - >>> mock.method.assert_awaited_once() + >>> mock.assert_awaited_once() Traceback (most recent call last): ... AssertionError: Expected mock to have been awaited once. Awaited 2 times. @@ -972,7 +974,7 @@ object:: >>> mock.assert_awaited_with('other') Traceback (most recent call last): ... - AssertionError: expected call not found. + AssertionError: expected await not found. Expected: mock('other') Actual: mock('foo', bar='bar') |