Doctests and decorated methods don't get along
steve at REMOVE-THIS-cybersource.com.au
Sun Feb 7 00:58:07 CET 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.
> Doctest has to scan the dict, so it does not see the attribute-lookup
Ahaha, now we're getting somewhere. If I do this:
>>> import inspect
>>> import test_doctests
>>> method3 = test_doctests.Test.__dict__['method3']
which is what I want to see. Presumably doctest.DocTestFinder needs a
patch to call methoddescriptor's __get__ method.
(BTW, classmethod, staticmethod and property are all special-cased by
More information about the Python-list