Doctests and decorated methods don't get along

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Feb 6 19:51:19 EST 2010


On Sat, 06 Feb 2010 14:39:00 -0500, Terry Reedy wrote:

> On 2/6/2010 6:48 AM, Steven D'Aprano wrote:
>> It seems that doctest doesn't discover or execute doctests in methods
>> which have been decorated [by method descriptors].

[...]

>> This looks like  bug to me. Have I missed anything?
> 
> I would call it a limitation as I do not see the doc as promising
> otherwise. I believe doctest predates the descripter protocol, at least
> in its current form, so it may not be completely descriptor-aware. You
> certainly could file a feature request for improved recognition and
> subsequent calling of __get__. An initial patch would improve chances of
> action.

I have found an existing report for this issue:

http://bugs.python.org/issue4037

The original poster's suggested fix was on the right track, but not 
complete. I've added a patch which works according to my tests.

Since this report is currently unassigned, is there a protocol for 
raising its profile and having somebody check my patch for inclusion? 
Should I just send an email to python-dev?


-- 
Steven




More information about the Python-list mailing list