mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-19 07:35:19 +00:00
Fix parse_lpo_and_dwpp not raising ValueError under some circumstances (#5268)
Co-authored-by: JSap0914 <JSap0914@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
bugfixes = "Fixed ``parse_lpo_and_dwpp`` silently overwriting ``link_preview_options`` when ``disable_web_page_preview=False``."
|
||||
[[pull_requests]]
|
||||
uid = "5268"
|
||||
author_uids = ["JSap0914"]
|
||||
closes_threads = []
|
||||
@@ -86,7 +86,7 @@ def parse_lpo_and_dwpp(
|
||||
"""Wrapper around warn_about_deprecated_arg_return_new_arg. Takes care of converting
|
||||
disable_web_page_preview to LinkPreviewOptions.
|
||||
"""
|
||||
if disable_web_page_preview and link_preview_options:
|
||||
if disable_web_page_preview is not None and link_preview_options:
|
||||
raise ValueError(
|
||||
"Parameters `disable_web_page_preview` and `link_preview_options` are mutually "
|
||||
"exclusive."
|
||||
|
||||
@@ -97,6 +97,11 @@ class TestInputTextMessageContentWithoutRequest(InputTextMessageContentTestBase)
|
||||
InputTextMessageContent(
|
||||
"text", disable_web_page_preview=True, link_preview_options=LinkPreviewOptions()
|
||||
)
|
||||
# disable_web_page_preview=False is also an explicit value and must conflict
|
||||
with pytest.raises(ValueError, match="`link_preview_options` are mutually exclusive"):
|
||||
InputTextMessageContent(
|
||||
"text", disable_web_page_preview=False, link_preview_options=LinkPreviewOptions()
|
||||
)
|
||||
|
||||
def test_disable_web_page_preview_deprecation(self):
|
||||
itmc = InputTextMessageContent("text", disable_web_page_preview=True)
|
||||
|
||||
Reference in New Issue
Block a user