[issue30548] typo in documentation for create_autospec

2019-10-30 Thread Erik Byström
Erik Byström added the comment: Yes, you're right. I do think the docs are a bit misleading. Maybe something like this would make it more clear? "If a class is used as a spec then the returned object will be a mock of that class. When the constructor of the returned mock class is invoked an

[issue30548] typo in documentation for create_autospec

2019-10-29 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30548] typo in documentation for create_autospec

2019-01-25 Thread Cheryl Sabella
Cheryl Sabella added the comment: Mario is right that this isn't a typo. Here's a code example to illustrate what he said: >>> class MyClass: ... a = 3 ... def foo(self): pass ... >>> mock_class = create_autospec(MyClass) >>> mock_class >>> mock_class() >>> mock_class.foo >>>

[issue30548] typo in documentation for create_autospec

2017-11-05 Thread Mario Corchero
Mario Corchero 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

[issue30548] typo in documentation for create_autospec

2017-06-02 Thread Erik Byström
New submission from Erik Byström: "a class" should most probably be replaced by "an instance" in the documentation for create_autospec. "You can use a class as the spec for an instance object by passing instance=True. The returned mock will only be callable if instances of the mock are