title: How to patch multiple repeated inputs in python unit test?
body: <p>I'm trying to unit test a function that can have multiple repeated inputs from within a while statement:</p>
  
  <pre><code>def ask_yes_or_no(prompt):  
      while True:
          answer = input(prompt)
          if answer.capitalize()[0] == 'Y':
              return True
          elif answer.capitalize()[0] == 'N':
              return False
  
  def human_move(computer_score, human_score):
      total = 0
      roll_again = True
      while roll_again:
          if ask_yes_or_no('Roll again? '):
              points = roll()
              print('You rolled a ' + str(points))
              if points == 1:
                  total = 0
                  roll_again = False
              else:
                  total += points
          else:
              roll_again = False
  </code></pre>
  
  <p>So far I've used the <code>mock</code> module with a <code>with</code> statement to simulate the input. e.g.:</p>
  
  <pre><code>def test_human_move(self):
          random.seed(900)
          with unittest.mock.patch('builtins.input', return_value = 'N'):
              self.assertEqual(human_move(0,0), 0)
  </code></pre>
  
  <p>However this only works for a single one time input. Is there a way to simulate a repeated input> For instance if the user input ('Y', 'Y', 'Y', 'N')?</p>
  
  <p>Sorry if that's not a very clear explanation.</p>
  
  <p>Thanks.</p>