Just as an example, it might seem illogical. I have a get_name function as below, and wanted to write a automated script to call this function and enter to the raw_inp
raw_inp
Another option is to make the input function a parameter, defaulting to raw_input:
raw_input
def get_name(infunc=raw_input): name = infunc("Please enter your name : ") print "Hi " + name
Then for testing purposes you can pass in a function that does whatever you need:
get_name(lambda prompt: "John Smith")