diff options
| author | Gregory P. Smith <greg@krypto.org> | 2016-10-06 21:32:10 (GMT) |
|---|---|---|
| committer | Gregory P. Smith <greg@krypto.org> | 2016-10-06 21:32:10 (GMT) |
| commit | 7bd4afec86849a57b48f375a9c4e0c32f0539dad (patch) | |
| tree | c7ba0066e4e4e759407a13745eaf8064a1e213ce /Lib/unittest/mock.py | |
| parent | a7bb9cc2b7d1c37761d497eb43a4dbfceaba1158 (diff) | |
| parent | ac5084b6c760ff5e6469854373fe6c3c81804f87 (diff) | |
| download | cpython-7bd4afec86849a57b48f375a9c4e0c32f0539dad.zip cpython-7bd4afec86849a57b48f375a9c4e0c32f0539dad.tar.gz cpython-7bd4afec86849a57b48f375a9c4e0c32f0539dad.tar.bz2 | |
Issue #28380: unittest.mock Mock autospec functions now properly support
assert_called, assert_not_called, and assert_called_once.
Diffstat (limited to 'Lib/unittest/mock.py')
| -rw-r--r-- | Lib/unittest/mock.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index eaa9c3d..f134919 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -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 |
