[issue21740] doctest doesn't allow duck-typing callables

Antoine Pitrou report at bugs.python.org
Thu Jun 12 22:59:13 CEST 2014


New submission from Antoine Pitrou:

doctest uses inspect.isfunction() to detect callable objects on which to detect docstrings. Unfortunately, this prevents running doctests on functions which have been decorated to return other types of callables (for example numba's @jit decorator). In the attached example file, the wrapped "bar" function does not have its doctest executed.

It would be useful for doctest to be more flexible here, although I'm not sure what the exact criterion should be.

----------
components: Library (Lib)
files: ducktest.py
messages: 220384
nosy: ezio.melotti, gvanrossum, michael.foord, pitrou, r.david.murray, rhettinger, tim.peters
priority: normal
severity: normal
stage: needs patch
status: open
title: doctest doesn't allow duck-typing callables
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file35601/ducktest.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21740>
_______________________________________


More information about the Python-bugs-list mailing list