title: How to mock global variable of List Type?
body: <p>I'm trying to mock a global variable which is list type.</p>
  
  <p>Below is the illustration - </p>
  
  <p>This is <strong>first_main.py</strong> -</p>
  
  <p><code>url=[]</code> -- <em>The result off <code>url.append(hello.replace(-test',''))</code> is getting stored here which is in <code>method_a()</code> and this is global variable</em></p>
  
  <pre><code>def method_a():
      url.append(hello.replace(-test',''))
      return something
  </code></pre>
  
  <p>Now, <code>url=[]</code> is used in another method.</p>
  
  <pre><code>def method_b():
      *Some codes and url=[] is used here in this code.*
      print url
      return True
  </code></pre>
  
  <p>Now, I'm testing <code>method_b</code> - </p>
  
  <pre><code>@mock.patch('first_main.url')
  def test_method_b(self, mock_url_list):
      mock_url_list.return_value.url.return_value = [['a','b'],['c','d']]
      reponse = method_b()
      print response
  </code></pre>
  
  <p>Now, if i put a print statement for <code>url</code> which is getting used in <code>method_b</code> it should return me the <code>[['a','b'],['c','d']]</code> instead of id.</p>
  
  <p>------------<strong>Console</strong>------------</p>
  
  <p><code>MagicMock name='url' id='090909090'</code></p>
  
  <p>I want return_type in list ie. <code>[['a','b'],['c','d']]</code> instead of id.</p>
  
  <p>Thank You</p>
  
  <p>Let me know incase of clarification.</p>