Message305609
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 |
|
Date |
User |
Action |
Args |
2017-11-05 19:07:21 | mariocj89 | set | recipients:
+ mariocj89, docs@python, Erik Byström |
2017-11-05 19:07:21 | mariocj89 | set | messageid: <1509908841.96.0.213398074469.issue30548@psf.upfronthosting.co.za> |
2017-11-05 19:07:21 | mariocj89 | link | issue30548 messages |
2017-11-05 19:07:21 | mariocj89 | create | |
|