def test_basic(self, dp): handler = StringCommandHandler('test', self.callback_basic) dp.add_handler(handler) assert handler.check_update('/test') dp.process_update('/test') assert self.test_flag assert not handler.check_update('/nottest') assert not handler.check_update('not /test in front') assert handler.check_update('/test followed by text')
def test_basic(self, dp): handler = StringCommandHandler('test', self.callback_basic) dp.add_handler(handler) check = handler.check_update('/test') assert check is not None and check is not False dp.process_update('/test') assert self.test_flag check = handler.check_update('/nottest') assert check is None or check is False check = handler.check_update('not /test in front') assert check is None or check is False check = handler.check_update('/test followed by text') assert check is not None and check is not False
def test_other_update_types(self, false_update): handler = StringCommandHandler('test', self.callback_basic) assert not handler.check_update(false_update)