mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 14:46:29 +01:00
Fix Failing Tests by Making Them Independent (#4494)
This commit is contained in:
parent
3409f51107
commit
9709c03b35
1 changed files with 11 additions and 2 deletions
|
@ -2863,10 +2863,13 @@ class TestBotWithRequest:
|
||||||
assert message.entities == tuple(entities)
|
assert message.entities == tuple(entities)
|
||||||
|
|
||||||
@pytest.mark.parametrize("default_bot", [{"parse_mode": "Markdown"}], indirect=True)
|
@pytest.mark.parametrize("default_bot", [{"parse_mode": "Markdown"}], indirect=True)
|
||||||
async def test_edit_message_text_default_parse_mode(self, default_bot, message):
|
async def test_edit_message_text_default_parse_mode(self, default_bot, chat_id):
|
||||||
test_string = "Italic Bold Code"
|
test_string = "Italic Bold Code"
|
||||||
test_markdown_string = "_Italic_ *Bold* `Code`"
|
test_markdown_string = "_Italic_ *Bold* `Code`"
|
||||||
|
|
||||||
|
# can't use `message` fixture as that would change its value
|
||||||
|
message = await default_bot.send_message(chat_id, "dummy text")
|
||||||
|
|
||||||
message = await default_bot.edit_message_text(
|
message = await default_bot.edit_message_text(
|
||||||
text=test_markdown_string,
|
text=test_markdown_string,
|
||||||
chat_id=message.chat_id,
|
chat_id=message.chat_id,
|
||||||
|
@ -2937,10 +2940,16 @@ class TestBotWithRequest:
|
||||||
# edit_message_media is tested in test_inputmedia
|
# edit_message_media is tested in test_inputmedia
|
||||||
|
|
||||||
@pytest.mark.parametrize("default_bot", [{"parse_mode": "Markdown"}], indirect=True)
|
@pytest.mark.parametrize("default_bot", [{"parse_mode": "Markdown"}], indirect=True)
|
||||||
async def test_edit_message_caption_default_parse_mode(self, default_bot, media_message):
|
async def test_edit_message_caption_default_parse_mode(self, default_bot, chat_id):
|
||||||
test_string = "Italic Bold Code"
|
test_string = "Italic Bold Code"
|
||||||
test_markdown_string = "_Italic_ *Bold* `Code`"
|
test_markdown_string = "_Italic_ *Bold* `Code`"
|
||||||
|
|
||||||
|
# can't use `media_message` fixture as that would change its value
|
||||||
|
with data_file("telegram.ogg").open("rb") as f:
|
||||||
|
media_message = await default_bot.send_voice(
|
||||||
|
chat_id, voice=f, caption="my caption", read_timeout=10
|
||||||
|
)
|
||||||
|
|
||||||
message = await default_bot.edit_message_caption(
|
message = await default_bot.edit_message_caption(
|
||||||
caption=test_markdown_string,
|
caption=test_markdown_string,
|
||||||
chat_id=media_message.chat_id,
|
chat_id=media_message.chat_id,
|
||||||
|
|
Loading…
Reference in a new issue