Simulte user input using doctest

Bartolomé Sintes Marco BartolomeSintes at ono.com
Mon Jun 23 13:14:59 EDT 2003


Hi,
Is it possible to simulate user input in a doctest docstring? For example, I
want to test if this module writes "Andy" when the user writes "Andy". What
would be the docstring?
def askyourname():
    print "What's your name?",
    myname = raw_input()
    print myname

Best regards,
Barto






More information about the Python-list mailing list