Migrate from Black to Ruff (#1750)

* Migrate from Black to Ruff and reformat code with enabling additional linter checks

* Add changelog for migration to Ruff as formatter and linter

* Add type ignores for specific attributes and replace tuple with set for chat type check

* Remove file from another changes
This commit is contained in:
Alex Root Junior 2026-01-04 21:34:08 +02:00 committed by GitHub
parent a4a3f42c71
commit ec7da0f678
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
214 changed files with 886 additions and 964 deletions

View file

@ -1,12 +1,8 @@
import asyncio
from collections.abc import AsyncGenerator, AsyncIterable
from typing import (
Any,
AsyncContextManager,
AsyncGenerator,
AsyncIterable,
Dict,
List,
Union,
)
from unittest.mock import AsyncMock, patch
@ -115,10 +111,10 @@ class TestAiohttpSession:
str_: str
int_: int
bool_: bool
unset_: Union[str, Default] = Default("parse_mode")
unset_: str | Default = Default("parse_mode")
null_: None
list_: List[str]
dict_: Dict[str, Any]
list_: list[str]
dict_: dict[str, Any]
session = AiohttpSession()
form = session.build_form_data(

View file

@ -1,6 +1,7 @@
import datetime
import json
from typing import Any, AsyncContextManager, AsyncGenerator, Dict, Optional
from collections.abc import AsyncGenerator
from typing import Any, AsyncContextManager
from unittest.mock import AsyncMock, patch
import pytest
@ -39,7 +40,7 @@ class CustomSession(BaseSession):
self,
token: str,
method: TelegramMethod[TelegramType],
timeout: Optional[int] = UNSET_PARSE_MODE,
timeout: int | None = UNSET_PARSE_MODE,
) -> None: # type: ignore
assert isinstance(token, str)
assert isinstance(method, TelegramMethod)
@ -47,7 +48,7 @@ class CustomSession(BaseSession):
async def stream_content(
self,
url: str,
headers: Optional[Dict[str, Any]] = None,
headers: dict[str, Any] | None = None,
timeout: int = 30,
chunk_size: int = 65536,
raise_for_status: bool = True,

View file

@ -15,5 +15,5 @@ class TestAddStickerToSet:
sticker="file id", format=StickerFormat.STATIC, emoji_list=[":)"]
),
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestAnswerCallbackQuery:
prepare_result = bot.add_result_for(AnswerCallbackQuery, ok=True, result=True)
response: bool = await bot.answer_callback_query(callback_query_id="cq id", text="OK")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -17,5 +17,5 @@ class TestAnswerInlineQuery:
)
],
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -9,5 +9,5 @@ class TestAnswerPreCheckoutQuery:
response: bool = await bot.answer_pre_checkout_query(
pre_checkout_query_id="query id", ok=True
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestAnswerShippingQuery:
prepare_result = bot.add_result_for(AnswerShippingQuery, ok=True, result=True)
response: bool = await bot.answer_shipping_query(shipping_query_id="query id", ok=True)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -15,5 +15,5 @@ class TestAnswerWebAppQuery:
thumbnail_url="test",
),
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestApproveChatJoinRequest:
chat_id=-42,
user_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestApproveSuggestedPost:
chat_id=-42,
message_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestKickChatMember:
prepare_result = bot.add_result_for(BanChatMember, ok=True, result=True)
response: bool = await bot.ban_chat_member(chat_id=-42, user_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestBanChatSenderChat:
chat_id=-42,
sender_chat_id=-1337,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestClose:
prepare_result = bot.add_result_for(Close, ok=True, result=True)
response: bool = await bot.close()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestCloseForumTopic:
chat_id=42,
message_thread_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestCloseGeneralForumTopic:
prepare_result = bot.add_result_for(CloseGeneralForumTopic, ok=True, result=True)
response: bool = await bot.close_general_forum_topic(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -9,5 +9,5 @@ class TestConvertGiftToStars:
response: bool = await bot.convert_gift_to_stars(
business_connection_id="test_connection_id", owned_gift_id="test_gift_id"
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -12,5 +12,5 @@ class TestCopyMessage:
from_chat_id=42,
message_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -20,5 +20,5 @@ class TestCreateChatInviteLink:
response: ChatInviteLink = await bot.create_chat_invite_link(
chat_id=-42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -24,5 +24,5 @@ class TestCreateChatSubscriptionInviteLink:
subscription_period=timedelta(days=30),
subscription_price=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -15,5 +15,5 @@ class TestCreateForumTopic:
chat_id=42,
name="test",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -17,5 +17,5 @@ class TestCreateInvoiceLink:
currency="BTC",
prices=[LabeledPrice(label="Test", amount=1)],
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -20,5 +20,5 @@ class TestCreateNewStickerSet:
],
sticker_format=StickerFormat.STATIC,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestDeclineChatJoinRequest:
chat_id=-42,
user_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestDeclineSuggestedPost:
chat_id=-42,
message_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -9,5 +9,5 @@ class TestDeleteBusinessMessages:
response: bool = await bot.delete_business_messages(
business_connection_id="test_connection_id", message_ids=[1, 2, 3]
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestDeleteChatPhoto:
prepare_result = bot.add_result_for(DeleteChatPhoto, ok=True, result=True)
response: bool = await bot.delete_chat_photo(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestDeleteChatStickerSet:
prepare_result = bot.add_result_for(DeleteChatStickerSet, ok=True, result=True)
response: bool = await bot.delete_chat_sticker_set(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestDeleteForumTopic:
chat_id=42,
message_thread_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestDeleteMessage:
prepare_result = bot.add_result_for(DeleteMessage, ok=True, result=True)
response: bool = await bot.delete_message(chat_id=42, message_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestKickChatMember:
prepare_result = bot.add_result_for(DeleteMyCommands, ok=True, result=True)
response: bool = await bot.delete_my_commands()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestDeleteStickerFromSet:
prepare_result = bot.add_result_for(DeleteStickerFromSet, ok=True, result=True)
response: bool = await bot.delete_sticker_from_set(sticker="sticker id")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestDeleteStickerSet:
prepare_result = bot.add_result_for(DeleteStickerSet, ok=True, result=True)
response: bool = await bot.delete_sticker_set(name="test")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -9,5 +9,5 @@ class TestDeleteStory:
response: bool = await bot.delete_story(
business_connection_id="test_connection_id", story_id=42
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestDeleteWebhook:
prepare_result = bot.add_result_for(DeleteWebhook, ok=True, result=True)
response: bool = await bot.delete_webhook()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -20,5 +20,5 @@ class TestEditChatInviteLink:
response: ChatInviteLink = await bot.edit_chat_invite_link(
chat_id=-42, invite_link="https://t.me/username", member_limit=1
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -22,5 +22,5 @@ class TestEditChatSubscriptionInviteLink:
invite_link="https://t.me/username/test",
name="test",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -12,5 +12,5 @@ class TestEditForumTopic:
name="test",
icon_custom_emoji_id="0",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestCloseGeneralForumTopic:
prepare_result = bot.add_result_for(EditGeneralForumTopic, ok=True, result=True)
response: bool = await bot.edit_general_forum_topic(chat_id=42, name="Test")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,4 @@
import datetime
from typing import Union
from aiogram.methods import EditMessageCaption
from aiogram.types import Chat, Message
@ -19,6 +18,6 @@ class TestEditMessageCaption:
),
)
response: Union[Message, bool] = await bot.edit_message_caption()
request = bot.get_request()
response: Message | bool = await bot.edit_message_caption()
bot.get_request()
assert response == prepare_result.result

View file

@ -31,5 +31,5 @@ class TestEditMessageChecklist:
message_id=42,
checklist=checklist,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import Union
from aiogram.methods import EditMessageLiveLocation
from aiogram.types import Message
from tests.mocked_bot import MockedBot
@ -9,8 +7,8 @@ class TestEditMessageLiveLocation:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=True)
response: Union[Message, bool] = await bot.edit_message_live_location(
response: Message | bool = await bot.edit_message_live_location(
latitude=3.141592, longitude=3.141592
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import Union
from aiogram.methods import EditMessageMedia
from aiogram.types import BufferedInputFile, InputMediaPhoto, Message
from tests.mocked_bot import MockedBot
@ -9,8 +7,8 @@ class TestEditMessageMedia:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(EditMessageMedia, ok=True, result=True)
response: Union[Message, bool] = await bot.edit_message_media(
response: Message | bool = await bot.edit_message_media(
media=InputMediaPhoto(media=BufferedInputFile(b"", "photo.png"))
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import Union
from aiogram.methods import EditMessageReplyMarkup
from aiogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from tests.mocked_bot import MockedBot
@ -9,7 +7,7 @@ class TestEditMessageReplyMarkup:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(EditMessageReplyMarkup, ok=True, result=True)
response: Union[Message, bool] = await bot.edit_message_reply_markup(
response: Message | bool = await bot.edit_message_reply_markup(
chat_id=42,
inline_message_id="inline message id",
reply_markup=InlineKeyboardMarkup(
@ -18,5 +16,5 @@ class TestEditMessageReplyMarkup:
]
),
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import Union
from aiogram.methods import EditMessageText
from aiogram.types import Message
from tests.mocked_bot import MockedBot
@ -9,8 +7,8 @@ class TestEditMessageText:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(EditMessageText, ok=True, result=True)
response: Union[Message, bool] = await bot.edit_message_text(
response: Message | bool = await bot.edit_message_text(
chat_id=42, inline_message_id="inline message id", text="text"
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
import datetime
from aiogram.methods import EditStory
from aiogram.types import Chat, InputStoryContentPhoto, Story
from tests.mocked_bot import MockedBot
@ -22,5 +20,5 @@ class TestEditStory:
content=InputStoryContentPhoto(type="photo", photo="test_photo"),
caption="Test caption",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -11,5 +11,5 @@ class TestEditUserStarSubscription:
telegram_payment_charge_id="telegram_payment_charge_id",
is_canceled=False,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -9,5 +9,5 @@ class TestExportChatInviteLink:
)
response: str = await bot.export_chat_invite_link(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -28,5 +28,5 @@ class TestGetAvailableGifts:
)
response: Gifts = await bot.get_available_gifts()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -37,5 +37,5 @@ class TestGetBusinessAccountGifts:
business_connection_id="test_connection_id",
limit=10,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -17,5 +17,5 @@ class TestGetBusinessAccountStarBalance:
response: StarAmount = await bot.get_business_account_star_balance(
business_connection_id="test_connection_id",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -20,5 +20,5 @@ class TestGetBusinessConnection:
response: BusinessConnection = await bot.get_business_connection(
business_connection_id="test"
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -25,5 +25,5 @@ class TestGetChat:
)
response: ChatFullInfo = await bot.get_chat(chat_id=-42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import List
from aiogram.methods import GetChatAdministrators
from aiogram.types import ChatMember, ChatMemberOwner, User
from tests.mocked_bot import MockedBot
@ -16,6 +14,6 @@ class TestGetChatAdministrators:
)
],
)
response: List[ChatMember] = await bot.get_chat_administrators(chat_id=-42)
request = bot.get_request()
response: list[ChatMember] = await bot.get_chat_administrators(chat_id=-42)
bot.get_request()
assert response == prepare_result.result

View file

@ -37,5 +37,5 @@ class TestGetChatGifts:
chat_id=42,
limit=10,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -13,5 +13,5 @@ class TestGetChatMember:
),
)
response = await bot.get_chat_member(chat_id=-42, user_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestGetChatMembersCount:
prepare_result = bot.add_result_for(GetChatMemberCount, ok=True, result=42)
response: int = await bot.get_chat_member_count(chat_id=-42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -8,5 +8,5 @@ class TestGetChatMenuButton:
prepare_result = bot.add_result_for(GetChatMenuButton, ok=True, result=MenuButtonDefault())
response: MenuButton = await bot.get_chat_menu_button()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import List
from aiogram.methods import GetCustomEmojiStickers
from aiogram.types import Sticker
from tests.mocked_bot import MockedBot
@ -24,8 +22,8 @@ class TestGetCustomEmojiStickers:
],
)
response: List[Sticker] = await bot.get_custom_emoji_stickers(
response: list[Sticker] = await bot.get_custom_emoji_stickers(
custom_emoji_ids=["1", "2"],
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestGetFile:
)
response: File = await bot.get_file(file_id="file id")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import List
from aiogram.methods import GetForumTopicIconStickers
from aiogram.types import Sticker
from tests.mocked_bot import MockedBot
@ -9,6 +7,6 @@ class TestGetForumTopicIconStickers:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(GetForumTopicIconStickers, ok=True, result=[])
response: List[Sticker] = await bot.get_forum_topic_icon_stickers()
request = bot.get_request()
response: list[Sticker] = await bot.get_forum_topic_icon_stickers()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import List
from aiogram.methods import GetGameHighScores
from aiogram.types import GameHighScore, User
from tests.mocked_bot import MockedBot
@ -17,6 +15,6 @@ class TestGetGameHighScores:
],
)
response: List[GameHighScore] = await bot.get_game_high_scores(user_id=42)
request = bot.get_request()
response: list[GameHighScore] = await bot.get_game_high_scores(user_id=42)
bot.get_request()
assert response == prepare_result.result

View file

@ -9,7 +9,7 @@ class TestGetMe:
GetMe, ok=True, result=User(id=42, is_bot=False, first_name="User")
)
response: User = await bot.get_me()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result
async def test_me_property(self, bot: MockedBot):

View file

@ -1,5 +1,3 @@
from typing import List
from aiogram.methods import GetMyCommands
from aiogram.types import BotCommand
from tests.mocked_bot import MockedBot
@ -9,6 +7,6 @@ class TestGetMyCommands:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(GetMyCommands, ok=True, result=None)
response: List[BotCommand] = await bot.get_my_commands()
request = bot.get_request()
response: list[BotCommand] = await bot.get_my_commands()
bot.get_request()
assert response == prepare_result.result

View file

@ -24,5 +24,5 @@ class TestGetMyDefaultAdministratorRights:
)
response: ChatAdministratorRights = await bot.get_my_default_administrator_rights()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestGetMyDescription:
)
response: BotDescription = await bot.get_my_description()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestGetMyShortDescription:
)
response: BotShortDescription = await bot.get_my_short_description()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -14,5 +14,5 @@ class TestGetMyStarBalance:
)
response: StarAmount = await bot.get_my_star_balance()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -3,7 +3,6 @@ from datetime import datetime
from aiogram.enums import TransactionPartnerUserTransactionTypeEnum
from aiogram.methods import GetStarTransactions
from aiogram.types import (
File,
StarTransaction,
StarTransactions,
TransactionPartnerUser,
@ -45,5 +44,5 @@ class TestGetStarTransactions:
)
response: StarTransactions = await bot.get_star_transactions(limit=10, offset=0)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -29,5 +29,5 @@ class TestGetStickerSet:
)
response: StickerSet = await bot.get_sticker_set(name="test")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
from typing import List
from aiogram.methods import GetUpdates
from aiogram.types import Update
from tests.mocked_bot import MockedBot
@ -9,6 +7,6 @@ class TestGetUpdates:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(GetUpdates, ok=True, result=[Update(update_id=42)])
response: List[Update] = await bot.get_updates()
request = bot.get_request()
response: list[Update] = await bot.get_updates()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,4 @@
import datetime
from typing import Optional
import pytest
@ -31,9 +30,9 @@ class TestGetMessageUrl:
bot: MockedBot,
chat_type: str,
chat_id: int,
chat_username: Optional[str],
chat_username: str | None,
force_private: bool,
expected_result: Optional[str],
expected_result: str | None,
):
fake_chat = Chat(id=chat_id, username=chat_username, type=chat_type)
fake_message_id = 10
@ -80,11 +79,11 @@ class TestGetMessageUrl:
def test_get_url_if_topic_message(
self,
bot: MockedBot,
chat_username: Optional[str],
chat_username: str | None,
force_private: bool,
include_thread_id: bool,
fake_thread_id_topic: Optional[int],
expected_result: Optional[str],
fake_thread_id_topic: int | None,
expected_result: str | None,
):
fake_message_id = 10
fake_chat_id = -1001234567890

View file

@ -37,5 +37,5 @@ class TestGetUserGifts:
user_id=42,
limit=10,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -17,5 +17,5 @@ class TestGetUserProfilePhotos:
)
response: UserProfilePhotos = await bot.get_user_profile_photos(user_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -14,5 +14,5 @@ class TestGetWebhookInfo:
)
response: WebhookInfo = await bot.get_webhook_info()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -12,5 +12,5 @@ class TestGiftPremiumSubscription:
star_count=1000,
text="Enjoy your premium subscription!",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestHideGeneralForumTopic:
prepare_result = bot.add_result_for(HideGeneralForumTopic, ok=True, result=True)
response: bool = await bot.hide_general_forum_topic(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestLeaveChat:
prepare_result = bot.add_result_for(LeaveChat, ok=True, result=True)
response: bool = await bot.leave_chat(chat_id=-42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestLogOut:
prepare_result = bot.add_result_for(LogOut, ok=True, result=True)
response: bool = await bot.log_out()
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestPinChatMessage:
prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=True)
response: bool = await bot.pin_chat_message(chat_id=-42, message_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,3 @@
import datetime
from aiogram.methods import PostStory
from aiogram.types import Chat, InputStoryContentPhoto, Story
from tests.mocked_bot import MockedBot
@ -22,5 +20,5 @@ class TestPostStory:
active_period=6 * 3600, # 6 hours
caption="Test story caption",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestPromoteChatMember:
prepare_result = bot.add_result_for(PromoteChatMember, ok=True, result=True)
response: bool = await bot.promote_chat_member(chat_id=-42, user_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -9,5 +9,5 @@ class TestReadBusinessMessage:
response: bool = await bot.read_business_message(
business_connection_id="test_connection_id", chat_id=123456789, message_id=42
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestRefundStarPayment:
user_id=42,
telegram_payment_charge_id="12345",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -11,5 +11,5 @@ class TestRemoveBusinessAccountProfilePhoto:
response: bool = await bot.remove_business_account_profile_photo(
business_connection_id="test_connection_id", is_public=True
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,4 @@
from aiogram.methods import RemoveChatVerification, VerifyChat
from aiogram.types import Poll
from aiogram.methods import RemoveChatVerification
from tests.mocked_bot import MockedBot
@ -8,5 +7,5 @@ class TestRemoveChatVerification:
prepare_result = bot.add_result_for(RemoveChatVerification, ok=True, result=True)
response: bool = await bot.remove_chat_verification(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -1,5 +1,4 @@
from aiogram.methods import RemoveUserVerification, VerifyChat
from aiogram.types import Poll
from aiogram.methods import RemoveUserVerification
from tests.mocked_bot import MockedBot
@ -8,5 +7,5 @@ class TestRemoveUserVerification:
prepare_result = bot.add_result_for(RemoveUserVerification, ok=True, result=True)
response: bool = await bot.remove_user_verification(user_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestReopenForumTopic:
chat_id=42,
message_thread_id=42,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -7,5 +7,5 @@ class TestReopenGeneralForumTopic:
prepare_result = bot.add_result_for(ReopenGeneralForumTopic, ok=True, result=True)
response: bool = await bot.reopen_general_forum_topic(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -17,5 +17,5 @@ class TestReplaceStickerInSet:
emoji_list=["test"],
),
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -20,5 +20,5 @@ class TestRepostStory:
from_story_id=456,
active_period=6 * 3600,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -10,5 +10,5 @@ class TestRestrictChatMember:
response: bool = await bot.restrict_chat_member(
chat_id=-42, user_id=42, permissions=ChatPermissions()
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -21,5 +21,5 @@ class TestRevokeChatInviteLink:
chat_id=-42,
invite_link="https://t.me/username",
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -30,5 +30,5 @@ class TestSavePreparedInlineMessage:
),
),
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -21,5 +21,5 @@ class TestSendAnimation:
)
response: Message = await bot.send_animation(chat_id=42, animation="file id")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -19,5 +19,5 @@ class TestSendAudio:
)
response: Message = await bot.send_audio(chat_id=42, audio="file id")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -8,5 +8,5 @@ class TestSendChatAction:
prepare_result = bot.add_result_for(SendChatAction, ok=True, result=True)
response: bool = await bot.send_chat_action(chat_id=42, action=ChatAction.TYPING)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -30,5 +30,5 @@ class TestSendChecklist:
chat_id=42,
checklist=checklist,
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -21,5 +21,5 @@ class TestSendContact:
response: Message = await bot.send_contact(
chat_id=42, phone_number="911", first_name="911"
)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -8,5 +8,5 @@ class TestSendDice:
prepare_result = bot.add_result_for(SendDice, ok=True, result=None)
response: Message = await bot.send_dice(chat_id=42)
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

View file

@ -19,5 +19,5 @@ class TestSendDocument:
)
response: Message = await bot.send_document(chat_id=42, document="file id")
request = bot.get_request()
bot.get_request()
assert response == prepare_result.result

Some files were not shown because too many files have changed in this diff Show more