title: Mocking a function called within a function called within a function
body: <p>Let's say I have a file called <code>src/sample.py</code> which contains:</p>
  <pre><code>def c():
      return np.random.rand(10)
  def b():
      return c() + 2
  def a():
      return b() + 1
  </code></pre>
  <p>Then, in my <code>sample_test.py</code>, suppose in <code>test_a</code>, I want to mock the internal call to <code>c</code> inside of <code>b</code>. However, if I do:</p>
  <pre><code>def mocked_c():
      return np.repeat(1, repeats=10)
  
  def test_a(mocker):
      mocker.patch('src.sample.c', mocked_c)
      assert np.all(a() == 5)
  </code></pre>
  <p>it won't actually mock the function <code>c</code>. However, since <code>b</code> is called directly in a, using <code>mocker.patch</code> on it will work as expected.</p>
  <p>What's the correct way to mock <code>c</code> inside <code>test_a</code>?</p>