title: Unable to return a tuple when mocking a function
body: <p>I'm trying to get comfortable with mocking in Python and I'm stumbling while trying to mock the following function.</p>
  
  <p><code>helpers.py</code></p>
  
  <pre><code>from path import Path
  
  def sanitize_line_ending(filename):
      """ Converts the line endings of the file to the line endings
          of the current system.
      """
      input_path = Path(filename)
  
      with input_path.in_place() as (reader, writer):
          for line in reader:
              writer.write(line)
  </code></pre>
  
  <p><code>test_helpers.py</code></p>
  
  <pre><code>@mock.patch('downloader.helpers.Path')
  def test_sanitize_line_endings(self, mock_path):
      mock_path.in_place.return_value = (1,2)
      helpers.sanitize_line_ending('varun.txt')
  </code></pre>
  
  <p>However I constantly get the following error:</p>
  
  <p><code>ValueError: need more than 0 values to unpack</code></p>
  
  <p>Given that I've set the return value to be a tuple, I don't understand why Python is unable to unpack it.</p>
  
  <p>I then changed my code to have <code>test_sanitize_line_endings</code> store print return value of <code>input_path.in_place()</code> and I can see that the return value is a <code>MagicMock</code> object. Specifically it prints something like
  <code>&lt;MagicMock name='Path().in_place()' id='13023525345'&gt;</code>
  If I understand things correctly, what I want is to have <code>mock_path</code> be the MagicMock which has an in_place function that returns a tuple.</p>
  
  <p>What am I doing wrong, and how can I go about correctly replacing the return value of <code>input_path.in_place()</code> in <code>sanitize_line_ending</code>.</p>