title: python mock different instances
body: <p>I would like to know the difference between <code>pg.connect</code> and <code>pg.connect()</code> statements.</p>
  
  <p><code>pg</code> is a psycopg2 mock object and when I display the <code>dir</code>, it shows connect as its method.</p>
  
  <pre><code>class TestMock(unittest.TestCase):
      def setUp(self):
          pass
  
      def test_mock_calls(self):
          import pprint
          pg = mock.MagicMock(psycopg2)
          print 'pg() object ', pg()
          print 'dir of pg = ', pprint.pprint(dir(pg))
  
          print 'dir of pg = ', pg.connect
          print 'dir of pg.connect = ', pprint.pprint(dir(pg.connect))
  
          print 'dir of pg = ', pg.connect()
          print 'dir of pg.connect() = ', 
          pprint.pprint(dir(pg.connect()))
  </code></pre>
  
  <p>Updates:-
  One(pg.connect) is accessing the attribute and other one(pg.connect()) calling the function.</p>
  
  <p>Now, how can I set the return_value of the execute method?</p>
  
  <p>For example:- I need to mock the response of my execute method.</p>
  
  <p>so, it should be pg.connect().cursor().execute.side_effect = someexception()</p>