def test_equality(self):
        a = telegram.PhotoSize(self.photo_file_id, self.width, self.height)
        b = telegram.PhotoSize(self.photo_file_id, self.width, self.height)
        c = telegram.PhotoSize(self.photo_file_id, 0, 0)
        d = telegram.PhotoSize("", self.width, self.height)
        e = telegram.Sticker(self.photo_file_id, self.width, self.height)

        self.assertEqual(a, b)
        self.assertEqual(hash(a), hash(b))
        self.assertIsNot(a, b)

        self.assertEqual(a, c)
        self.assertEqual(hash(a), hash(c))

        self.assertNotEqual(a, d)
        self.assertNotEqual(hash(a), hash(d))

        self.assertNotEqual(a, e)
        self.assertNotEqual(hash(a), hash(e))
示例#2
0
# TEXT

SAMPLE_TEXT = 'Alohomora'

SAMPLE_TEXT_MESSAGE = telegram.Message(message_id=1,
                                       from_user=SAMPLE_USER,
                                       date=SAMPLE_DATE,
                                       chat=SAMPLE_CHAT,
                                       text=SAMPLE_TEXT)

SAMPLE_TEXT_UPDATE = telegram.Update(update_id=1, message=SAMPLE_TEXT_MESSAGE)

# STICKER

SAMPLE_STICKER_PHOTOSIZE = telegram.PhotoSize(file_id='photosize_id',
                                              width=10,
                                              height=10,
                                              file_size=100)

SAMPLE_STICKER = telegram.Sticker(file_id='sticker_id',
                                  width=100,
                                  height=100,
                                  thumb=SAMPLE_STICKER_PHOTOSIZE,
                                  file_size=10000)

SAMPLE_STICKER_MESSAGE = telegram.Message(message_id=1,
                                          from_user=SAMPLE_USER,
                                          date=SAMPLE_DATE,
                                          chat=SAMPLE_CHAT,
                                          sticker=SAMPLE_STICKER)

SAMPLE_STICKER_UPDATE = telegram.Update(update_id=2,