Python mock.patch: replace a method : <p>I'd like to replace a method in a class with mock:</p>

<pre><code>from unittest.mock import patch

class A(object):
    def method(self, string):
        print(self, "method", string)

def method2(self, string):
    print(self, "method2", string)

with patch.object(A, 'method', side_effect=method2):
    a = A()
    a.method("string")
    a.method.assert_called_with("string")
</code></pre>

<p>...but I get insulted by the computer:</p>

<pre><code>TypeError: method2() missing 1 required positional argument: 'string'
</code></pre>
