> Suppose I had a function like the following:
#
def y_n(prompt="Answer yes or no"):
while True:
answer = raw_input(prompt)
if answer in ['y', 'Y', 'yes']:
print "You said yes!"
break
elif answer in ['n', 'N', 'no']:
print
On Tue, 18 Apr 2006, Andre Roberge wrote:
> Suppose I had a function like the following:
>
> def y_n(prompt="Answer yes or no"):
>while True:
>answer = raw_input(prompt)
>if answer in ['y', 'Y', 'yes']:
>print "You said yes!"
>break
>elif answe
On Tuesday 18 April 2006 23:34, Andre Roberge wrote:
> Hi all-
>
> Suppose I had a function like the following:
>
> [ function that interacts with the outside world ]
...
> How could I go about to write an automated test for it?
You create a mock for raw_input, put the above code inside a module a
Hi all-
Suppose I had a function like the following:
def y_n(prompt="Answer yes or no"):
while True:
answer = raw_input(prompt)
if answer in ['y', 'Y', 'yes']:
print "You said yes!"
break
elif answer in ['n', 'N', 'no']:
print "You s