title: Mock a function call being used inside list's append
body: <p>I have a code like this:</p>
  
  <pre><code>def create_namespace():
      _create_foobar()
      _create_spamegg()
  
  p = list()
  p.append(create_namespace())
  </code></pre>
  
  <p>I need to mock _create_foobar and _create_spamegg (both defined in same file)and have been able to do so with normal patch, but when i run the test cases which is written like this:</p>
  
  <pre><code>from xyz import create_namespace
  @patch('path.to.file._create_foobar', mock_func)
  @patch('path.to.file._create_spamegg', mock_func)
  def test_create_namespace():
      assert create_namespace() is None
  </code></pre>
  
  <p>I get the same error while running the test cases as i would have got i were not successful 
  in mocking <code>_create_foobar and _create_spamegg</code>. If I comment out <code>p.append(create_namespace())</code>
  the test cases run successfully. I have been trying things like <code>patch.object()</code>, using <code>patcher in setUp</code> but to no avail, Can this code be tested, Please suggest how this can be done?</p>