[Python-bugs-list] [ python-Feature Requests-674689 ] enhancements for doctest

SourceForge.net noreply@sourceforge.net
Sat, 25 Jan 2003 11:44:54 -0800


Feature Requests item #674689, was opened at 2003-01-25 14:44
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=674689&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 4
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Tim Peters (tim_one)
Summary: enhancements for doctest

Initial Comment:
1) Add a method, doctest.regen(outputfile, 
module=None), which creates a copy of the module 
but with the test results unconditionally updated.  
This is similar in spirit to the -g option for regrtest.py.

The principal use case is to handle a situation where 
only the output formatting has changed, but the 
internal logic is unchanged (suppose, for instance, 
that L stopped appearing at the end of long integers).


2) Add options for sloppy test matches: 
doctest.testmod(mymod, strictdictorder=False, 
exactfloats=False).  The default should continue to be 
strict.

The goal is to make doctest easier to use and 
produce more readable documentation by eliminating 
the gyrations to avoid dependencies on dictionary 
order or exact floating point results.  Replace this:

>>> r = mydict.items()
>>> r.sort()  
>>> r
[('eggs',1), ('spam', 2)]
>>> round(1./7, 5)
0.14285999999999999

with this:

>>> mydict.items()
[('eggs',1), ('spam', 2)]
>>> 1./7
0.14285714285714285


3) Since the interactive session may have been 
produced in IDLE instead of the command line, don't 
depend on PS2 being equal to "...". 

If the first line after '>>>' startswith('...'), then 
continue to use '...', but if it doesn't, then continue to 
read input until a black line is encountered (i.e. match 
the logic used by IDLE). 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=674689&group_id=5470