Open GoogleCodeExporter opened 8 years ago
The correct keyword is "_name" instead of "name". The latter would be more
obvious though.
>>> class A(object):
... pass
...
>>> import mock
>>> a = mock.create_autospec(A, _name='A')
>>> a
<MagicMock name='A' spec='A' id='140235987196624'>
Original comment by sieb...@gmail.com
on 18 Dec 2014 at 12:13
How is anyone supposed to know this? The documentation for create_autospec says:
>create_autospec also takes arbitrary keyword arguments that are passed to the
constructor of the created mock.
The documentation for mock says:
>name: If the mock has a name then it will be used in the repr of the mock.
This can be useful for debugging. The name is propagated to child mocks.
Absolutely bizarre.
Original comment by plasmash...@gmail.com
on 18 Dec 2014 at 6:53
Original issue reported on code.google.com by
plasmash...@gmail.com
on 8 Apr 2014 at 12:14