doctests for interactive functions

Neil Cerutti horpner at yahoo.com
Thu Feb 8 15:25:53 EST 2007


On 2007-02-08, Brian van den Broek <broek at cc.umanitoba.ca> wrote:
> All classes take an optional argument input_function that
> determines how the class instance gets its input. If this is
> not provided, it defaults to raw_input. doctest tests reassign
> it so that they can be run automatically.

What I've done in these cases is create a file containing my test
input, and before running the doctests I remap sys.stdin to my
file of test data. Then you don't need test code cluttering up
your functions.

-- 
Neil Cerutti
We don't necessarily discriminate.  We simply exclude certain types of people.
--Colonel Gerald Wellman



More information about the Python-list mailing list