16 lines
248 B
Python
16 lines
248 B
Python
from unittest.mock import patch
|
|
|
|
|
|
class A:
|
|
def method(self, arg):
|
|
pass
|
|
|
|
|
|
def dummy(self, arg):
|
|
print("DUMMY CALLED", arg)
|
|
|
|
|
|
with patch("__main__.A.method") as mock_method:
|
|
mock_method.side_effect = dummy
|
|
A().method("hello")
|