def test_with_pattern(self, chosen_inline_result): handler = ChosenInlineResultHandler(self.callback_basic, pattern='.*ult.*') assert handler.check_update(chosen_inline_result) chosen_inline_result.chosen_inline_result.result_id = 'nothing here' assert not handler.check_update(chosen_inline_result) chosen_inline_result.chosen_inline_result.result_id = 'result_id'
def test_basic(self, dp, chosen_inline_result): handler = ChosenInlineResultHandler(self.callback_basic) dp.add_handler(handler) assert handler.check_update(chosen_inline_result) dp.process_update(chosen_inline_result) assert self.test_flag
def test_other_update_types(self, false_update): handler = ChosenInlineResultHandler(self.callback_basic) assert not handler.check_update(false_update)