title: How to mock instance variables
body: <p>I am trying to write a test for a class like this:</p>
  
  <pre><code>from public_library import SuperClass
  from another_library import Foo
  
  
  class MyClass(SuperClass):
  
      def __init__(self):
          # Call super class
          super(MyClass, self).__init__()
  
          self._foo = Foo(
              name='Some Name',
              thing='Some Thing',
              # self.something is defined in SuperClass.__init__()
              cool=self.something.cool(),
          )
  </code></pre>
  
  <p>In my test, I have mocked <code>Foo</code> class and call <code>assert_called_once_with()</code> to make sure <code>self._foo</code> is set up properly. However, I cannot figure out how to get the return value of <code>self.something.cool()</code>.</p>
  
  <p>Sure, I can set the return value to an instance variable under <code>self</code> and use that in my test, but that seems like an ugly solution. Is there a way I can use <code>patch()</code> to do this?</p>