Staging
v0.8.1
v0.8.1
https://github.com/python/cpython
Revision 12b9fb603eea9298c835bae5b8742db4fa52892e authored by Miss Islington (bot) on 08 December 2018, 11:41:52 UTC, committed by Chris Withers on 08 December 2018, 11:41:52 UTC
* 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>
1 parent 2d6bc25
Tip revision: 12b9fb603eea9298c835bae5b8742db4fa52892e authored by Miss Islington (bot) on 08 December 2018, 11:41:52 UTC
bpo-35330: Don't call the wrapped object if `side_effect` is set (GH11034)
bpo-35330: Don't call the wrapped object if `side_effect` is set (GH11034)
Tip revision: 12b9fb6
File | Mode | Size |
---|---|---|
clinic | ||
stringlib | ||
README | -rw-r--r-- | 41 bytes |
abstract.c | -rw-r--r-- | 80.9 KB |
accu.c | -rw-r--r-- | 2.4 KB |
boolobject.c | -rw-r--r-- | 6.5 KB |
bytearrayobject.c | -rw-r--r-- | 69.3 KB |
bytes_methods.c | -rw-r--r-- | 21.0 KB |
bytesobject.c | -rw-r--r-- | 99.0 KB |
capsule.c | -rw-r--r-- | 7.3 KB |
cellobject.c | -rw-r--r-- | 4.8 KB |
classobject.c | -rw-r--r-- | 18.2 KB |
codeobject.c | -rw-r--r-- | 28.2 KB |
complexobject.c | -rw-r--r-- | 31.7 KB |
descrobject.c | -rw-r--r-- | 53.9 KB |
dict-common.h | -rw-r--r-- | 2.2 KB |
dictnotes.txt | -rw-r--r-- | 6.0 KB |
dictobject.c | -rw-r--r-- | 131.9 KB |
enumobject.c | -rw-r--r-- | 13.1 KB |
exceptions.c | -rw-r--r-- | 86.1 KB |
fileobject.c | -rw-r--r-- | 15.3 KB |
floatobject.c | -rw-r--r-- | 70.7 KB |
frameobject.c | -rw-r--r-- | 33.9 KB |
funcobject.c | -rw-r--r-- | 30.4 KB |
genobject.c | -rw-r--r-- | 67.9 KB |
iterobject.c | -rw-r--r-- | 8.9 KB |
listobject.c | -rw-r--r-- | 86.0 KB |
listsort.txt | -rw-r--r-- | 34.9 KB |
lnotab_notes.txt | -rw-r--r-- | 5.7 KB |
longobject.c | -rw-r--r-- | 167.5 KB |
memoryobject.c | -rw-r--r-- | 88.8 KB |
methodobject.c | -rw-r--r-- | 15.5 KB |
moduleobject.c | -rw-r--r-- | 22.6 KB |
namespaceobject.c | -rw-r--r-- | 7.4 KB |
object.c | -rw-r--r-- | 57.8 KB |
obmalloc.c | -rw-r--r-- | 80.2 KB |
odictobject.c | -rw-r--r-- | 75.8 KB |
rangeobject.c | -rw-r--r-- | 37.1 KB |
setobject.c | -rw-r--r-- | 73.0 KB |
sliceobject.c | -rw-r--r-- | 19.2 KB |
structseq.c | -rw-r--r-- | 12.9 KB |
tupleobject.c | -rw-r--r-- | 29.9 KB |
typeobject.c | -rw-r--r-- | 232.8 KB |
typeslots.inc | -rw-r--r-- | 3.9 KB |
typeslots.py | -rwxr-xr-x | 1.2 KB |
unicodectype.c | -rw-r--r-- | 7.5 KB |
unicodeobject.c | -rw-r--r-- | 457.5 KB |
unicodetype_db.h | -rw-r--r-- | 234.1 KB |
weakrefobject.c | -rw-r--r-- | 29.5 KB |
Computing file changes ...