def test_equality(self): a = InputContactMessageContent('phone', 'first', last_name='last') b = InputContactMessageContent('phone', 'first_name', vcard='vcard') c = InputContactMessageContent('phone_number', 'first', vcard='vcard') d = User(123, 'first', False) assert a == b assert hash(a) == hash(b) assert a != c assert hash(a) != hash(c) assert a != d assert hash(a) != hash(d)
def test_equality(self): a = InputContactMessageContent("phone", "first", last_name="last") b = InputContactMessageContent("phone", "first_name", vcard="vcard") c = InputContactMessageContent("phone_number", "first", vcard="vcard") d = User(123, "first", False) assert a == b assert hash(a) == hash(b) assert a != c assert hash(a) != hash(c) assert a != d assert hash(a) != hash(d)
def de_json(data): data = super(InputMessageContent, InputMessageContent).de_json(data) if not data: return None try: from telegram import InputTextMessageContent return InputTextMessageContent.de_json(data) except TypeError: pass try: from telegram import InputLocationMessageContent return InputLocationMessageContent.de_json(data) except TypeError: pass try: from telegram import InputVenueMessageContent return InputVenueMessageContent.de_json(data) except TypeError: pass try: from telegram import InputContactMessageContent return InputContactMessageContent.de_json(data) except TypeError: pass return None
def de_json(data, bot): data = super(InputMessageContent, InputMessageContent).de_json(data, bot) if not data: return None try: from telegram import InputTextMessageContent return InputTextMessageContent.de_json(data, bot) except TypeError: pass try: from telegram import InputVenueMessageContent return InputVenueMessageContent.de_json(data, bot) except TypeError: pass try: from telegram import InputLocationMessageContent return InputLocationMessageContent.de_json(data, bot) except TypeError: pass try: from telegram import InputContactMessageContent return InputContactMessageContent.de_json(data, bot) except TypeError: pass return None
def test_de_json(self, json_dict, bot): input_contact_message_content_json = InputContactMessageContent.de_json( json_dict, bot) assert input_contact_message_content_json.first_name == self.first_name assert input_contact_message_content_json.phone_number == self.phone_number assert input_contact_message_content_json.last_name == self.last_name
def input_contact_message_content(): return InputContactMessageContent( TestInputContactMessageContent.phone_number, TestInputContactMessageContent.first_name, last_name=TestInputContactMessageContent.last_name)