def test_equality(self): a = StickerSet( self.name, self.title, self.is_animated, self.contains_masks, self.stickers, self.is_video, ) b = StickerSet( self.name, self.title, self.is_animated, self.contains_masks, self.stickers, self.is_video, ) c = StickerSet(self.name, None, None, None, None, None) d = StickerSet( 'blah', self.title, self.is_animated, self.contains_masks, self.stickers, self.is_video ) e = Audio(self.name, '', 0, None, None) 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 test_de_json(self, bot): name = 'test_by_{0}'.format(bot.username) json_dict = { 'name': name, 'title': self.title, 'contains_masks': self.contains_masks, 'stickers': [x.to_dict() for x in self.stickers] } sticker_set = StickerSet.de_json(json_dict, bot) assert sticker_set.name == name assert sticker_set.title == self.title assert sticker_set.contains_masks == self.contains_masks assert sticker_set.stickers == self.stickers
def test_de_json(self, bot, sticker): name = f'test_by_{bot.username}' json_dict = { 'name': name, 'title': self.title, 'is_animated': self.is_animated, 'contains_masks': self.contains_masks, 'stickers': [x.to_dict() for x in self.stickers], 'thumb': sticker.thumb.to_dict(), } sticker_set = StickerSet.de_json(json_dict, bot) assert sticker_set.name == name assert sticker_set.title == self.title assert sticker_set.is_animated == self.is_animated assert sticker_set.contains_masks == self.contains_masks assert sticker_set.stickers == self.stickers assert sticker_set.thumb == sticker.thumb
def test_de_json(self, bot, sticker): name = f"test_by_{bot.username}" json_dict = { "name": name, "title": self.title, "is_animated": self.is_animated, "is_video": self.is_video, "contains_masks": self.contains_masks, "stickers": [x.to_dict() for x in self.stickers], "thumb": sticker.thumb.to_dict(), } sticker_set = StickerSet.de_json(json_dict, bot) assert sticker_set.name == name assert sticker_set.title == self.title assert sticker_set.is_animated == self.is_animated assert sticker_set.is_video == self.is_video assert sticker_set.contains_masks == self.contains_masks assert sticker_set.stickers == self.stickers assert sticker_set.thumb == sticker.thumb