diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-12-08 11:41:52 (GMT) |
---|---|---|
committer | Chris Withers <chris@withers.org> | 2018-12-08 11:41:52 (GMT) |
commit | 12b9fb603eea9298c835bae5b8742db4fa52892e (patch) | |
tree | 16f266f891f92fcf85a284807bc586fb42dd16cd /Lib/cgitb.py | |
parent | 2d6bc25dbc3dc5662f13917eb759f92842bf6de6 (diff) | |
download | cpython-12b9fb603eea9298c835bae5b8742db4fa52892e.zip cpython-12b9fb603eea9298c835bae5b8742db4fa52892e.tar.gz cpython-12b9fb603eea9298c835bae5b8742db4fa52892e.tar.bz2 |
bpo-35330: Don't call the wrapped object if `side_effect` is set (GH11034)
* tests: Further validate `wraps` functionality in `unittest.mock.Mock`
Add more tests to validate how `wraps` interacts with other features of
mocks.
* Don't call the wrapped object if `side_effect` is set
When a object is wrapped using `Mock(wraps=...)`, if an user sets a
`side_effect` in one of their methods, return the value of `side_effect`
and don't call the original object.
* Refactor what to be called on `mock_call`
When a `Mock` is called, it should return looking up in the following
order: `side_effect`, `return_value`, `wraps`. If any of the first two
return `mock.DEFAULT`, lookup in the next option.
It makes no sense to check for `wraps` returning default, as it is
supposed to be the original implementation and there is nothing to
fallback to.
(cherry picked from commit f05df0a4b679d0acfd0b1fe6187ba2d553b37afa)
Co-authored-by: Mario Corchero <mariocj89@gmail.com>
Diffstat (limited to 'Lib/cgitb.py')
0 files changed, 0 insertions, 0 deletions