This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mariocj89
Recipients Erik Byström, docs@python, mariocj89
Date 2017-11-05.19:07:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509908841.96.0.213398074469.issue30548@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-11-05 19:07:21mariocj89setrecipients: + mariocj89, docs@python, Erik Byström
2017-11-05 19:07:21mariocj89setmessageid: <1509908841.96.0.213398074469.issue30548@psf.upfronthosting.co.za>
2017-11-05 19:07:21mariocj89linkissue30548 messages
2017-11-05 19:07:21mariocj89create