mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fixes issue28380: unittest.mock Mock autospec functions now properly support
assert_called, assert_not_called, and assert_called_once.
This commit is contained in:
parent
0ebdd0776c
commit
ac5084b6c7
3 changed files with 18 additions and 0 deletions
|
@ -193,6 +193,12 @@ def _setup_func(funcopy, mock):
|
|||
|
||||
def assert_called_with(*args, **kwargs):
|
||||
return mock.assert_called_with(*args, **kwargs)
|
||||
def assert_called(*args, **kwargs):
|
||||
return mock.assert_called(*args, **kwargs)
|
||||
def assert_not_called(*args, **kwargs):
|
||||
return mock.assert_not_called(*args, **kwargs)
|
||||
def assert_called_once(*args, **kwargs):
|
||||
return mock.assert_called_once(*args, **kwargs)
|
||||
def assert_called_once_with(*args, **kwargs):
|
||||
return mock.assert_called_once_with(*args, **kwargs)
|
||||
def assert_has_calls(*args, **kwargs):
|
||||
|
@ -223,6 +229,9 @@ def _setup_func(funcopy, mock):
|
|||
funcopy.assert_has_calls = assert_has_calls
|
||||
funcopy.assert_any_call = assert_any_call
|
||||
funcopy.reset_mock = reset_mock
|
||||
funcopy.assert_called = assert_called
|
||||
funcopy.assert_not_called = assert_not_called
|
||||
funcopy.assert_called_once = assert_called_once
|
||||
|
||||
mock._mock_delegate = funcopy
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue