def create_contact_inline_result(doc: Document) -> InlineQueryResultContact: content = doc.content return InlineQueryResultContact( id=doc.internal_id, phone_number=content['phone_number'], first_name=content['first_name'], last_name=content.get('last_name'), vcard=content.get('vcard'), )
def test_equality(self): a = InlineQueryResultContact(self.id_, self.phone_number, self.first_name) b = InlineQueryResultContact(self.id_, self.phone_number, self.first_name) c = InlineQueryResultContact(self.id_, '', self.first_name) d = InlineQueryResultContact('', self.phone_number, self.first_name) e = InlineQueryResultVoice(self.id_, '', '') assert a == b assert hash(a) == hash(b) assert a is not b assert a == c assert hash(a) == hash(c) assert a != d assert hash(a) != hash(d) assert a != e assert hash(a) != hash(e)
def inline_query_result_contact(): return InlineQueryResultContact( TestInlineQueryResultContact.id, TestInlineQueryResultContact.phone_number, TestInlineQueryResultContact.first_name, last_name=TestInlineQueryResultContact.last_name, thumb_url=TestInlineQueryResultContact.thumb_url, thumb_width=TestInlineQueryResultContact.thumb_width, thumb_height=TestInlineQueryResultContact.thumb_height, input_message_content=TestInlineQueryResultContact.input_message_content, reply_markup=TestInlineQueryResultContact.reply_markup)