summaryrefslogtreecommitdiff
path: root/Lib/unittest/mock.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r--Lib/unittest/mock.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 3fafe594c5..92b596f672 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -817,6 +817,10 @@ class NonCallableMock(Base):
if child is None or isinstance(child, _SpecState):
break
else:
+ # If an autospecced object is attached using attach_mock the
+ # child would be a function with mock object as attribute from
+ # which signature has to be derived.
+ child = _extract_mock(child)
children = child._mock_children
sig = child._spec_signature