cpython: bbdfde7958a8 (original) (raw)
Mercurial > cpython
changeset 105628:bbdfde7958a8
Issue #28919: Simplify _copy_func_details() in unittest.mock Patch by Jiajun Huang. [#28919]
Berker Peksag berker.peksag@gmail.com | |
---|---|
date | Thu, 15 Dec 2016 05:21:44 +0300 |
parents | 0ff181ca7558 |
children | 13b600dc4ee5 |
files | Lib/unittest/mock.py |
diffstat | 1 files changed, 8 insertions(+), 18 deletions(-)[+] [-] Lib/unittest/mock.py 26 |
line wrap: on
line diff
--- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -104,26 +104,16 @@ def _check_signature(func, mock, skipfir def _copy_func_details(func, funcopy):
- funcopy.name = func.name
- funcopy.doc = func.doc
- try:
funcopy.__text_signature__ = func.__text_signature__[](#l1.10)
- except AttributeError:
pass[](#l1.12)
we explicitly don't copy func.dict into this copy as it would
expose original attributes that should be mocked
- try:
funcopy.__module__ = func.__module__[](#l1.16)
- except AttributeError:
pass[](#l1.18)
- try:
funcopy.__defaults__ = func.__defaults__[](#l1.20)
- except AttributeError:
pass[](#l1.22)
- try:
funcopy.__kwdefaults__ = func.__kwdefaults__[](#l1.24)
- except AttributeError:
pass[](#l1.26)