[ python-Bugs-1650090 ] doctest doesn't find nested functions
SourceForge.net
noreply at sourceforge.net
Sat Mar 17 01:37:16 CET 2007
Bugs item #1650090, was opened at 2007-02-01 20:20
Message generated for change (Comment added) made by zseil
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1650090&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Daniel Brown (danb37)
Assigned to: Tim Peters (tim_one)
Summary: doctest doesn't find nested functions
Initial Comment:
If a nested function has doctests, they won't be run:
{{{
def f():
'''
>>> 'a'
'a'
'''
def g():
'''
>>> 'a'
'b'
'''
pass
pass
}}}
DocTestFinder will only find f's doctest and won't recurse to find g's, surprising the programmer when they (hopefully) discover that their inner doctest is incorrect!
----------------------------------------------------------------------
>Comment By: Žiga Seilnacht (zseil)
Date: 2007-03-17 01:37
Message:
Logged In: YES
user_id=1326842
Originator: NO
Here is a patch that implements this new functionality.
I don't know how desireable this feature is, I just
wanted to see if it could be done.
File Added: doctest_nested_functions.diff
----------------------------------------------------------------------
Comment By: Piet Delport (pjdelport)
Date: 2007-03-16 21:44
Message:
Logged In: YES
user_id=1607528
Originator: NO
DocTestFinder uses object inspection to find docstrings, which doesn't
really allow this kind of thing: g isn't created until f is actually run.
Making this possible would probably require implementing an alternate
doctest finder based on source code inspection (via the new _ast module?).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1650090&group_id=5470
More information about the Python-bugs-list
mailing list