[New-bugs-announce] [issue4037] doctest.py should include method descriptors when looking inside a class __dict__

daaku report at bugs.python.org
Sat Oct 4 02:13:26 CEST 2008


New submission from daaku <n at daaku.org>:

doctest.py currently does not include doctests from method descriptors 
in a class.

The patch is simple, in the _find function in class DocTestFinder:

Original:
                # Recurse to methods, properties, and nested classes.
                if ((inspect.isfunction(val) or inspect.isclass(val) or
                      isinstance(val, property)) and
                      self._from_module(module, val)):

Patched:
                # Recurse to methods, properties, and nested classes.
                if ((inspect.isfunction(val) or inspect.isclass(val) or
                      inspect.ismethoddescriptor(val) or
                      isinstance(val, property)) and
                      self._from_module(module, val)):

Adding the "inspect.ismethoddescriptor(val) or" line.

----------
components: Library (Lib)
messages: 74285
nosy: daaku
severity: normal
status: open
title: doctest.py should include method descriptors when looking inside a class __dict__
versions: Python 2.6

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


More information about the New-bugs-announce mailing list