[issue26140] inspect.iscoroutinefunction raises TypeError when checks Mock of function or coroutinefunction

2016-01-17 Thread Hiroyuki Takagi
New submission from Hiroyuki Takagi: inspect.iscoroutinefunction and asyncio.iscoroutinefunction with patch of issue25599 (https://bugs.python.org/issue25599) raise TypeError when used to check Mock object which mocks function or coroutinefunction. How to reproduce: - For the mock of

[issue26140] inspect.iscoroutinefunction raises TypeError when checks Mock of function or coroutinefunction

2016-01-18 Thread Hiroyuki Takagi
Hiroyuki Takagi added the comment: Thank you for review and comment. Honestly speaking, I couldn't find any other good place to fix it. One possible solution might be to use isinstance(mock, Mock) in iscoroutinefunction, but I don't think it's good for inspect module to add sp

[issue26140] inspect.iscoroutinefunction raises TypeError when checks Mock of function or coroutinefunction

2016-01-19 Thread Hiroyuki Takagi
Hiroyuki Takagi added the comment: Thank you for reviewing patch. I wrote test and updated patch. To pass the test, both this patch and issue25599's patch are required. Changes of the patch: - copy __code__ not only functions but also methods - add autospec (create_autospec) suppoort I