[issue25312] Cryptic error message if incorrect spec is set on a callable mock

2019-07-31 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Using spec only checks for the attribute to be present and not the signature of the actual attribute being called. You might need autospec for this behavior. The below example to use create_autospec does the correct validation for mock_foo.func.

[issue25312] Cryptic error message if incorrect spec is set on a callable mock

2018-09-21 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue25312] Cryptic error message if incorrect spec is set on a callable mock

2015-10-09 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- nosy: +michael.foord ___ Python tracker ___ ___

[issue25312] Cryptic error message if incorrect spec is set on a callable mock

2015-10-04 Thread Tzu-ping Chung
New submission from Tzu-ping Chung: >>> from unittest import mock >>> >>> class Foo: ... def __init__(self, val): ... pass ... def func(self): ... pass ... >>> class FooMock(mock.Mock): ... def _get_child_mock(self, **kwargs): ... return