Author remi.lapeyre
Recipients Adnan Umer, remi.lapeyre
Date 2019-01-02.00:41:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1546389674.0.0.241829722582.issue35577@roundup.psfhosted.org>
In-reply-to
Content
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)

?
History
Date User Action Args
2019-01-02 00:41:15remi.lapeyresetrecipients: + remi.lapeyre, Adnan Umer
2019-01-02 00:41:14remi.lapeyresetmessageid: <1546389674.0.0.241829722582.issue35577@roundup.psfhosted.org>
2019-01-02 00:41:13remi.lapeyrelinkissue35577 messages
2019-01-02 00:41:13remi.lapeyrecreate