Rémi Lapeyre <[email protected]> added the comment:
Is there a problem with:
from unittest import mock
class SomeClass:
def do_something(self, x):
pass
def some_function(x):
obj = SomeClass()
y = obj.do_something(x)
return y
def do_something_side_effect(self, x):
print(self)
return x
def test_some_function():
with mock.patch.object(SomeClass, "do_something", do_something_side_effect):
assert some_function(1)
?
----------
nosy: +remi.lapeyre
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35577>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com