diff options
author | Kushal Das <kushaldas@gmail.com> | 2014-04-15 19:35:50 (GMT) |
---|---|---|
committer | Kushal Das <kushaldas@gmail.com> | 2014-04-15 19:35:50 (GMT) |
commit | 484f8a875b986690f9d8aec2089368b70184e009 (patch) | |
tree | 6953671c7a532c265b20f74fa67d7f969f4d9c79 /Lib/unittest/mock.py | |
parent | 9574355ff3cffde2dc67ee60a61e468cec1d46f7 (diff) | |
download | cpython-484f8a875b986690f9d8aec2089368b70184e009.zip cpython-484f8a875b986690f9d8aec2089368b70184e009.tar.gz cpython-484f8a875b986690f9d8aec2089368b70184e009.tar.bz2 |
Closes Issue 21222.
Passing name keyword argument to mock.create_autospec now works.
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index f1f6522..13fd7b1 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -2096,6 +2096,8 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None, elif is_type and instance and not _instance_callable(spec): Klass = NonCallableMagicMock + _name = _kwargs.pop('name', _name) + _new_name = _name if _parent is None: # for a top level object no _new_name should be set |