• Mario Corchero's avatar
    bpo-35330: Don't call the wrapped object if `side_effect` is set (GH10973) · f05df0a4
    Mario Corchero yazdı
    * 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.
    f05df0a4
Adı
Son kayıt (commit)
Son güncelleme
.azure-pipelines Loading commit data...
.github Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Programs Loading commit data...
Python Loading commit data...
Tools Loading commit data...
m4 Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README.rst Loading commit data...
aclocal.m4 Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...