Re: doctests for interactive functions

2007-02-09 Thread Neil Cerutti
On 2007-02-08, Brian van den Broek [EMAIL PROTECTED] wrote: Can I run the rough structure of my code past you to see if it is in the vicinity of what you mean? (I have removed some details for sake of a short(er :-)) post.) Yes, this is a good way to think about it. Separate input from

Re: doctests for interactive functions

2007-02-09 Thread Brian van den Broek
Neil Cerutti said unto the world upon 02/09/2007 08:52 AM: On 2007-02-08, Brian van den Broek [EMAIL PROTECTED] wrote: Can I run the rough structure of my code past you to see if it is in the vicinity of what you mean? (I have removed some details for sake of a short(er :-)) post.) Yes,

doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Hi all, I have a module of classes for getting input from the user that satisfies various constraints. For instance, one class is created with a menu of option, presents them to the user, and rejects any input other than a menu option; another ensures that the user's input is interpretable as

Re: doctests for interactive functions

2007-02-08 Thread Neil Cerutti
On 2007-02-08, Brian van den Broek [EMAIL PROTECTED] 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

Re: doctests for interactive functions

2007-02-08 Thread Ben Finney
Brian van den Broek [EMAIL PROTECTED] writes: Since the classes are for getting input interactively, a straightforward use of doctest is not going to work. (The tests won't run automatically.) I've come up with a way to make it work, but I would like to know from more experienced people if

Re: doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Ben Finney said unto the world upon 02/08/2007 03:03 PM: Brian van den Broek [EMAIL PROTECTED] writes: Since the classes are for getting input interactively, a straightforward use of doctest is not going to work. (The tests won't run automatically.) I've come up with a way to make it work,

Re: doctests for interactive functions

2007-02-08 Thread Brian van den Broek
Neil Cerutti said unto the world upon 02/08/2007 02:25 PM: On 2007-02-08, Brian van den Broek [EMAIL PROTECTED] 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