mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Removed deprecated arguments from Bot class (#1494)
* Remove deprecated attributes from Bot class The deprecated attributes `parse_mode`, `disable_web_page_preview`, and `protect_content` have been removed from the Bot class. Additionally, the associated warnings and test cases have been deleted. These attributes should now be passed using the `default=DefaultBotProperties(...)` syntax instead. * Added docs and changelog
This commit is contained in:
parent
895f4f8dce
commit
b5d94f17b5
5 changed files with 117 additions and 82 deletions
|
|
@ -12,7 +12,6 @@ from aiogram.client.session.aiohttp import AiohttpSession
|
|||
from aiogram.client.telegram import TelegramAPIServer
|
||||
from aiogram.methods import GetFile, GetMe
|
||||
from aiogram.types import File, PhotoSize
|
||||
from tests.deprecated import check_deprecated
|
||||
from tests.mocked_bot import MockedBot
|
||||
from tests.test_api.test_client.test_session.test_base_session import CustomSession
|
||||
|
||||
|
|
@ -55,36 +54,18 @@ class TestBot:
|
|||
|
||||
mocked_close.assert_awaited_once()
|
||||
|
||||
def test_init_default(self):
|
||||
with check_deprecated(
|
||||
max_version="3.7.0",
|
||||
exception=TypeError,
|
||||
):
|
||||
bot = Bot(token="42:Test", parse_mode="HTML")
|
||||
|
||||
def test_deprecated_parse_mode(self):
|
||||
with check_deprecated(
|
||||
max_version="3.7.0",
|
||||
exception=AttributeError,
|
||||
):
|
||||
bot = Bot(token="42:Test", parse_mode="HTML")
|
||||
assert bot.parse_mode == "HTML"
|
||||
|
||||
def test_disable_web_page_preview(self):
|
||||
with check_deprecated(
|
||||
max_version="3.7.0",
|
||||
exception=TypeError,
|
||||
):
|
||||
bot = Bot(token="42:Test", disable_web_page_preview=True)
|
||||
assert bot.disable_web_page_preview is True
|
||||
|
||||
def test_deprecated_protect_content(self):
|
||||
with check_deprecated(
|
||||
max_version="3.7.0",
|
||||
exception=AttributeError,
|
||||
):
|
||||
bot = Bot(token="42:Test", protect_content=True)
|
||||
assert bot.protect_content is True
|
||||
@pytest.mark.parametrize(
|
||||
"kwargs",
|
||||
[
|
||||
{"parse_mode": "HTML"},
|
||||
{"disable_web_page_preview": True},
|
||||
{"protect_content": True},
|
||||
{"parse_mode": True, "disable_web_page_preview": True},
|
||||
],
|
||||
)
|
||||
def test_init_default(self, kwargs):
|
||||
with pytest.raises(TypeError):
|
||||
Bot(token="42:Test", **kwargs)
|
||||
|
||||
def test_hashable(self):
|
||||
bot = Bot("42:TEST")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue