]> granicus.if.org Git - python/commitdiff
Remove more Python 2 code from unittest.mock (obsolete function attributes)
authorMichael Foord <michael@voidspace.org.uk>
Sun, 25 Mar 2012 18:16:10 +0000 (19:16 +0100)
committerMichael Foord <michael@voidspace.org.uk>
Sun, 25 Mar 2012 18:16:10 +0000 (19:16 +0100)
Lib/unittest/mock.py

index 1c7f33ad65b4da1f51b4ff911d9d140e1622aa7b..3cef550f9cf007b87cb78192d57558d809a8b2b5 100644 (file)
@@ -2037,10 +2037,6 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
             # MagicMock already does the useful magic methods for us
             continue
 
-        if isinstance(spec, FunctionTypes) and entry in FunctionAttributes:
-            # allow a mock to actually be a function
-            continue
-
         # XXXX do we need a better way of getting attributes without
         # triggering code execution (?) Probably not - we need the actual
         # object to mock it so we would rather trigger a property than mock
@@ -2128,16 +2124,6 @@ FunctionTypes = (
     type(_ANY.__eq__),
 )
 
-FunctionAttributes = set([
-    'func_closure',
-    'func_code',
-    'func_defaults',
-    'func_dict',
-    'func_doc',
-    'func_globals',
-    'func_name',
-])
-
 
 file_spec = None