def de_json(data):
        data = super(InlineQueryResultCachedVoice, InlineQueryResultCachedVoice).de_json(data)

        data["reply_markup"] = InlineKeyboardMarkup.de_json(data.get("reply_markup"))
        data["input_message_content"] = InputMessageContent.de_json(data.get("input_message_content"))

        return InlineQueryResultCachedVoice(**data)
    def de_json(data, bot):
        data = super(InlineQueryResultAudio, InlineQueryResultAudio).de_json(data, bot)

        data["reply_markup"] = InlineKeyboardMarkup.de_json(data.get("reply_markup"), bot)
        data["input_message_content"] = InputMessageContent.de_json(data.get("input_message_content"), bot)

        return InlineQueryResultAudio(**data)
    def de_json(data, bot):
        data = super(InlineQueryResultContact, InlineQueryResultContact).de_json(data, bot)

        data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
        data['input_message_content'] = InputMessageContent.de_json(
            data.get('input_message_content'), bot)

        return InlineQueryResultContact(**data)
    def de_json(data):
        data = super(InlineQueryResultDocument, InlineQueryResultDocument).de_json(data)

        data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'))
        data['input_message_content'] = InputMessageContent.de_json(data.get(
            'input_message_content'))

        return InlineQueryResultDocument(**data)
Ejemplo n.º 5
0
    def de_json(data):
        data = super(InlineQueryResultCachedGif,
                     InlineQueryResultCachedGif).de_json(data)

        data['reply_markup'] = InlineKeyboardMarkup.de_json(
            data.get('reply_markup'))
        data['input_message_content'] = InputMessageContent.de_json(
            data.get('input_message_content'))

        return InlineQueryResultCachedGif(**data)
Ejemplo n.º 6
0
    def de_json(data, bot):
        data = super(InlineQueryResultCachedVideo,
                     InlineQueryResultCachedVideo).de_json(data, bot)

        data['reply_markup'] = InlineKeyboardMarkup.de_json(
            data.get('reply_markup'), bot)
        data['input_message_content'] = InputMessageContent.de_json(
            data.get('input_message_content'), bot)

        return InlineQueryResultCachedVideo(**data)
    def de_json(cls, data, bot):
        data = super(InlineQueryResultPhoto, cls).de_json(data, bot)

        if not data:
            return None

        data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
        data['input_message_content'] = InputMessageContent.de_json(
            data.get('input_message_content'), bot)

        return cls(**data)
Ejemplo n.º 8
0
    def de_json(cls, data, bot):
        data = super(InlineQueryResultCachedAudio, cls).de_json(data, bot)

        if not data:
            return None

        data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
        data['input_message_content'] = InputMessageContent.de_json(
            data.get('input_message_content'), bot)

        return cls(**data)
Ejemplo n.º 9
0
    def test_de_json_factory_without_required_args(self, json_dict, bot):
        json_dict = json_dict

        del (json_dict['longitude'])
        del (json_dict['latitude'])
        del (json_dict['title'])
        del (json_dict['address'])

        input_venue_message_content_json = InputMessageContent.de_json(
            json_dict, bot)

        assert input_venue_message_content_json is None
Ejemplo n.º 10
0
    def test_de_json(self, bot):
        input_message_content = InputMessageContent.de_json(None, bot)

        assert input_message_content is None
Ejemplo n.º 11
0
    def test_de_json_factory(self, json_dict, bot):
        input_venue_message_content_json = InputMessageContent.de_json(
            json_dict, bot)

        assert isinstance(input_venue_message_content_json,
                          InputVenueMessageContent)
Ejemplo n.º 12
0
    def test_input_location_message_content_json_de_json_factory(self, json_dict, bot):
        input_location_message_content_json = InputMessageContent.de_json(json_dict, bot)

        assert isinstance(input_location_message_content_json, InputLocationMessageContent)