def mask_position(): return MaskPosition( TestMaskPosition.point, TestMaskPosition.x_shift, TestMaskPosition.y_shift, TestMaskPosition.scale, )
def test_equality(self): a = MaskPosition(self.point, self.x_shift, self.y_shift, self.scale) b = MaskPosition(self.point, self.x_shift, self.y_shift, self.scale) c = MaskPosition(MaskPosition.FOREHEAD, self.x_shift, self.y_shift, self.scale) d = MaskPosition(self.point, 0, 0, self.scale) e = Audio('', '', 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_bot_methods_1_png(self, bot, chat_id, sticker_file): with open('tests/data/telegram_sticker.png', 'rb') as f: file = bot.upload_sticker_file(95205500, f) assert file assert bot.add_sticker_to_set(chat_id, 'test_by_{}'.format(bot.username), png_sticker=file.file_id, emojis='😄') # Also test with file input and mask assert bot.add_sticker_to_set(chat_id, 'test_by_{}'.format(bot.username), png_sticker=sticker_file, emojis='😄', mask_position=MaskPosition( MaskPosition.EYES, -1, 1, 2))
def test_bot_methods_1_png(self, bot, chat_id, sticker_file): with open('tests/data/telegram_sticker.png', 'rb') as f: # chat_id was hardcoded as 95205500 but it stopped working for some reason file = bot.upload_sticker_file(chat_id, f) assert file assert bot.add_sticker_to_set( chat_id, f'test_by_{bot.username}', png_sticker=file.file_id, emojis='😄' ) # Also test with file input and mask assert bot.add_sticker_to_set( chat_id, f'test_by_{bot.username}', png_sticker=sticker_file, emojis='😄', mask_position=MaskPosition(MaskPosition.EYES, -1, 1, 2), )
async def test_bot_methods_1_png(self, bot, chat_id, sticker_file): with data_file("telegram_sticker.png").open("rb") as f: # chat_id was hardcoded as 95205500 but it stopped working for some reason file = await bot.upload_sticker_file(chat_id, f) assert file assert await bot.add_sticker_to_set(chat_id, f"test_by_{bot.username}", png_sticker=file.file_id, emojis="😄") # Also test with file input and mask assert await bot.add_sticker_to_set( chat_id, f"test_by_{bot.username}", png_sticker=sticker_file, emojis="😄", mask_position=MaskPosition(MaskPosition.EYES, -1, 1, 2), )