Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ab27c6

Browse files
committed
Remove more Python 2 code from unittest.mock (obsolete function attributes)
1 parent 0dccf65 commit 1ab27c6

1 file changed

Lines changed: 0 additions & 14 deletions

File tree

Lib/unittest/mock.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,10 +2037,6 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
20372037
# MagicMock already does the useful magic methods for us
20382038
continue
20392039

2040-
if isinstance(spec, FunctionTypes) and entry in FunctionAttributes:
2041-
# allow a mock to actually be a function
2042-
continue
2043-
20442040
# XXXX do we need a better way of getting attributes without
20452041
# triggering code execution (?) Probably not - we need the actual
20462042
# object to mock it so we would rather trigger a property than mock
@@ -2128,16 +2124,6 @@ def __init__(self, spec, spec_set=False, parent=None,
21282124
type(_ANY.__eq__),
21292125
)
21302126

2131-
FunctionAttributes = set([
2132-
'func_closure',
2133-
'func_code',
2134-
'func_defaults',
2135-
'func_dict',
2136-
'func_doc',
2137-
'func_globals',
2138-
'func_name',
2139-
])
2140-
21412127

21422128
file_spec = None
21432129

0 commit comments

Comments
 (0)