New submission from Theron Luhn:

>>> asyncio.iscoroutinefunction(unittest.mock.Mock())
<Mock name='mock._is_coroutine' id='4544068072'>

This is an unexpected response, both in type (Mock rather than boolean) and 
value (truthy).

inspect.iscoroutinefunction behaves as expected.

Workaround:

>>> m = unittest.mock.Mock()
>>> m._is_coroutine = False
>>> asyncio.iscoroutinefunction(m)
False

----------
components: asyncio
messages: 254457
nosy: Theron Luhn, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.iscoroutinefunction returns unexpected results when presented 
with unittest.mock.Mock
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25599>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to