title: How do you mock patch a python class and get a new Mock object for each instantiation?
body: <p>OK,<br>
  I know this is mentioned in the <a href="http://www.voidspace.org.uk/python/mock/" rel="noreferrer">manual</a>, and probably has to do with <code>side_effect</code> and/or <code>return_value</code>, but a simple, direct example will help me immensely.  </p>
  
  <p>I have: </p>
  
  <pre><code>class ClassToPatch():
     def __init__(self, *args):
         _do_some_init_stuff()
  
     def some_func():
         _do_stuff()
  
  
  class UUT():
      def __init__(self, *args)
         resource_1 = ClassToPatch()
         resource_2 = ClassToPatch()
  </code></pre>
  
  <p>Now, I want to unit test the <code>UUT</code> class, and mock the <code>ClassToPatch</code>. Knowing the <code>UUT</code> class will instantiate exactly two <code>ClassToPatch</code> objects, I want the Mock framework to return a new Mock object for each instantiation, so I can later assert calls on each separately.  </p>
  
  <p>How do I achieve this using the <code>@patch</code> decorator in a test case? Namely, how to fix the following code sample?</p>
  
  <pre><code>class TestCase1(unittest.TestCase):
  
      @patch('classToPatch.ClassToPatch',autospec=True)
      def test_1(self,mock1,mock2):
          _assert_stuff()
  </code></pre>