How do I check if a function is being called by a method?
<p>How do I check if a function b() is being called by a method?</p>

<pre><code>class hello():
    delete():
        b()
</code></pre>

<p>I want to use mock in a unit test.</p>

<p>Assuming you have a test environment you can in fire up the python(or the Ipython) shell and use the debugger to call the function:</p>

<p>if this is your function </p>

<pre><code>def multiplier(a,b):
    print a*b
</code></pre>

<p>then you can do this in the shell and debug the code:</p>

<pre><code>import ipdb
ipdb.runcall(multiplier, 10, 10)
</code></pre>

python django python-2.7 mocking