diff --git a/tests/test_bot.py b/tests/test_bot.py index df142e3fb..85232a8c7 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -2368,11 +2368,15 @@ class TestBotWithRequest: # test modules. No need to duplicate here. async def test_delete_messages(self, bot, chat_id): - msg1 = await bot.send_message(chat_id, text="will be deleted") - msg2 = await bot.send_message(chat_id, text="will be deleted") - await asyncio.sleep(2) + msg1, msg2 = await asyncio.gather( + bot.send_message(chat_id, text="will be deleted"), + bot.send_message(chat_id, text="will be deleted"), + ) - assert await bot.delete_messages(chat_id=chat_id, message_ids=(msg1.id, msg2.id)) is True + assert ( + await bot.delete_messages(chat_id=chat_id, message_ids=sorted((msg1.id, msg2.id))) + is True + ) async def test_send_venue(self, bot, chat_id): longitude = -46.788279 @@ -3915,7 +3919,7 @@ class TestBotWithRequest: msg1, msg2 = await tasks copy_messages = await bot.copy_messages( - chat_id, from_chat_id=chat_id, message_ids=(msg1.message_id, msg2.message_id) + chat_id, from_chat_id=chat_id, message_ids=sorted((msg1.message_id, msg2.message_id)) ) assert isinstance(copy_messages, tuple) diff --git a/tests/test_constants.py b/tests/test_constants.py index b750f7fba..dc76bea3a 100644 --- a/tests/test_constants.py +++ b/tests/test_constants.py @@ -234,6 +234,11 @@ class TestConstantsWithRequest: return_exceptions=True, ) good_msg, bad_msg = await tasks + + if isinstance(good_msg, BaseException): + # handling xfails + raise good_msg + assert good_msg.text == good_text assert isinstance(bad_msg, BadRequest) assert "Message is too long" in str(bad_msg) @@ -247,6 +252,11 @@ class TestConstantsWithRequest: return_exceptions=True, ) good_msg, bad_msg = await tasks + + if isinstance(good_msg, BaseException): + # handling xfails + raise good_msg + assert good_msg.caption == good_caption assert isinstance(bad_msg, BadRequest) assert "Message caption is too long" in str(bad_msg)