假设我有这个python代码:
def answer():
ans = raw_input('enter yes or no')
if ans == 'yes':
print 'you entered yes'
if ans == 'no':
print 'you entered no'
Run Code Online (Sandbox Code Playgroud)
我该如何为此编写单元测试?我知道我必须使用'模拟',但我不明白如何.有谁可以做一些简单的例子?