title: Python UT - Mocking a function local veriable
body: <p>I have a function as follows</p>
  
  <h2>Function</h2>
  
  <pre><code>   def foo(arg1, arg2, arg3): 
         # all the method code....
         parent = arg1.get_item(larg1)
         if larg2 not in parent.children:
              # do stuff
  </code></pre>
  
  <p>I want to mock <code>parent</code> in the method, so that when I call <code>parent.children</code> i can return empty list <code>[]</code>. 
  Thoughts?</p>
  
  <h2>Already tried</h2>
  
  <pre><code>@patch('foo.bar.foo')
  def test_my_test(self, mock_method)
      parent = mocked_method.return_value
      mocked_method.parent.children = []
  </code></pre>
  
  <p>** This mocks the entire method. </p>