async def METHOD_NAME(self, app, inline_query):
    handler = InlineQueryHandler(self.callback_pattern, pattern=r"(?P<begin>.*)est(?P<end>.*)")
    app.add_handler(handler)
    async with app:
        await app.process_update(inline_query)
        assert self.test_flag
        app.remove_handler(handler)
        handler = InlineQueryHandler(self.callback_pattern, pattern=r"(t)est(.*)")
        app.add_handler(handler)
        await app.process_update(inline_query)
        assert self.test_flag
        update = Update(
            update_id=0, inline_query=InlineQuery(id="id", from_user=None, query="", offset="")
        )
        update.inline_query._unfreeze()
        assert not handler.check_update(update)
        update.inline_query.query = "not_a_match"
        assert not handler.check_update(update)