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 test_de_json_factory_without_required_args(self, json_dict, bot): del (json_dict['message_text']) input_text_message_content_json = InputMessageContent.de_json( json_dict, bot) assert input_text_message_content_json is None
def test_input_text_message_content_json_de_json_factory( self, json_dict, bot): input_text_message_content_json = InputMessageContent.de_json( json_dict, bot) assert isinstance(input_text_message_content_json, InputTextMessageContent)
def test_de_json_factory_without_required_args(self, json_dict, bot): del (json_dict['phone_number']) del (json_dict['first_name']) input_contact_message_content_json = InputMessageContent.de_json(json_dict, bot) assert input_contact_message_content_json is None
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)
def de_json(data): data = super(InlineQueryResultCachedSticker, InlineQueryResultCachedSticker).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 InlineQueryResultCachedSticker(**data)
def test_de_json_factory_without_required_args(self, json_dict, bot): del (json_dict['longitude']) # If no args are passed it will fall in a different condition # del (json_dict['latitude']) input_location_message_content_json = InputMessageContent.de_json(json_dict, bot) assert input_location_message_content_json is None
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)
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)
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
def test_de_json(self, bot): input_message_content = InputMessageContent.de_json(None, bot) assert input_message_content is None
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)