title: How to mock a method return value of a class
body: <p>I want to mock</p>
  <pre><code>os.stat(self.tmp_file).st_size
  
  def original_func():
       print (os.stat(&quot;test.txt&quot;).st_size==35)
  </code></pre>
  <p>I tried this</p>
  <pre><code>@mock.patch(&quot;os.stat&quot;)
  def test(os_stat):
      stat = mock.Mock()
      stat.st_size.return_value = 35
      os_stat.return_value = stat
      original_func()
  </code></pre>
  <p>It does not work. The print statement should be true which it is not.</p>