Mario Corchero <[email protected]> added the comment:
I've always understood instance as a way to say "I am passing this class but I
want to force the autospec on the instance"
For example, given
```
class X:
def __init__(self):
raise
```
You can do `unittest.mock.create_autospec(X, instance=True)` to set a spec of
the instance rather than the class.
Also quite often you do autospec on a class but you want the interface of the
instance. This parameter allows you to do so.
Basically, `unittest.mock.create_autospec(X, instance=True)` will produce a non
callable mock.
I think the docs are correct, maybe misleading
----------
nosy: +mariocj89
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue30548>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com