如何在python3中对输入进行单元测试?

时间:2019-04-03 13:07:43

标签: python-3.x unit-testing io

我正在尝试在python3中测试各种输入函数,并且需要一种方法来模拟用户输入而不会提示用户并停止makefile的运行。

要测试的功能

def _input_wrapper(prompt, strip=True):
  try:
    reply = input(prompt).lower()
    if strip:
      reply = reply.strip()
  except EOFError:
    reply = ""
  return reply

0 个答案:

没有答案
相关问题