Ok, I have tried to figure out how they work but I am not entirely sure... would something like that work for test_chat.py for example?
def test_instance_method_send_message(self, monkeypatch, chat): def test(*args, **kwargs): return args[0] == chat.id and args[1] == 'test' monkeypatch.setattr('telegram.Bot.send_message', test) assert chat.send_message('test') def test_instance_method_send_audio(self, monkeypatch, chat): def test(*args, **kwargs): return args[0] == chat.id and args[1] == 'test_audio' monkeypatch.setattr('telegram.Bot.send_audio', test) assert chat.send_audio('test_audio')
Moreover, I have noticed that both Chat and User classes lack the tests for send_photo. Is that intentional or should I add them?