From 0acdb24c3c10ca7c813a41e0e6998ecdd42d85d7 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 23 Nov 2019 17:03:14 +0200 Subject: [PATCH] No cover `if TYPE_CHECKING` --- aiogram/__init__.py | 9 +------- aiogram/api/client/session/base.py | 11 ---------- aiogram/api/methods/base.py | 6 ++--- aiogram/api/types/animation.py | 2 +- aiogram/api/types/audio.py | 2 +- aiogram/api/types/callback_query.py | 2 +- aiogram/api/types/chat.py | 2 +- aiogram/api/types/chat_member.py | 2 +- aiogram/api/types/chosen_inline_result.py | 2 +- aiogram/api/types/document.py | 2 +- .../api/types/encrypted_passport_element.py | 2 +- aiogram/api/types/game.py | 2 +- aiogram/api/types/game_high_score.py | 2 +- aiogram/api/types/inline_keyboard_button.py | 2 +- aiogram/api/types/inline_keyboard_markup.py | 2 +- aiogram/api/types/inline_query.py | 2 +- .../api/types/inline_query_result_article.py | 2 +- .../api/types/inline_query_result_audio.py | 2 +- .../types/inline_query_result_cached_audio.py | 2 +- .../inline_query_result_cached_document.py | 2 +- .../types/inline_query_result_cached_gif.py | 2 +- .../inline_query_result_cached_mpeg4_gif.py | 2 +- .../types/inline_query_result_cached_photo.py | 2 +- .../inline_query_result_cached_sticker.py | 2 +- .../types/inline_query_result_cached_video.py | 2 +- .../types/inline_query_result_cached_voice.py | 2 +- .../api/types/inline_query_result_contact.py | 2 +- .../api/types/inline_query_result_document.py | 2 +- aiogram/api/types/inline_query_result_game.py | 2 +- aiogram/api/types/inline_query_result_gif.py | 2 +- .../api/types/inline_query_result_location.py | 2 +- .../types/inline_query_result_mpeg4_gif.py | 2 +- .../api/types/inline_query_result_photo.py | 2 +- .../api/types/inline_query_result_venue.py | 2 +- .../api/types/inline_query_result_video.py | 2 +- .../api/types/inline_query_result_voice.py | 2 +- aiogram/api/types/input_file.py | 2 +- aiogram/api/types/input_media_animation.py | 2 +- aiogram/api/types/input_media_audio.py | 2 +- aiogram/api/types/input_media_document.py | 2 +- aiogram/api/types/input_media_photo.py | 2 +- aiogram/api/types/input_media_video.py | 2 +- aiogram/api/types/message.py | 2 +- aiogram/api/types/message_entity.py | 2 +- aiogram/api/types/order_info.py | 2 +- aiogram/api/types/passport_data.py | 2 +- aiogram/api/types/poll.py | 2 +- aiogram/api/types/pre_checkout_query.py | 2 +- aiogram/api/types/reply_keyboard_markup.py | 2 +- aiogram/api/types/shipping_option.py | 2 +- aiogram/api/types/shipping_query.py | 2 +- aiogram/api/types/sticker.py | 2 +- aiogram/api/types/sticker_set.py | 2 +- aiogram/api/types/successful_payment.py | 2 +- aiogram/api/types/update.py | 2 +- aiogram/api/types/user_profile_photos.py | 2 +- aiogram/api/types/venue.py | 2 +- aiogram/api/types/video.py | 2 +- aiogram/api/types/video_note.py | 2 +- .../test_session/test_base_session.py | 22 ------------------- 60 files changed, 60 insertions(+), 100 deletions(-) diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 5f4f01ee..537a9994 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -2,14 +2,7 @@ from .api import methods, types from .api.client import session from .api.client.bot import Bot -try: - import uvloop - - uvloop.install() -except ImportError: - pass - -__all__ = ["__api_version__", "__version__", "types", "methods", "Bot", "session"] +__all__ = ("__api_version__", "__version__", "types", "methods", "Bot", "session") __version__ = "3.0.0a0" __api_version__ = "4.4" diff --git a/aiogram/api/client/session/base.py b/aiogram/api/client/session/base.py index 874af7bc..837b8709 100644 --- a/aiogram/api/client/session/base.py +++ b/aiogram/api/client/session/base.py @@ -41,17 +41,6 @@ class BaseSession(abc.ABC): async def make_request(self, token: str, method: TelegramMethod[T]) -> T: pass - def __del__(self): - try: - loop = asyncio.get_running_loop() - except RuntimeError: - loop = None - if loop is None or loop.is_closed(): - loop = asyncio.new_event_loop() - loop.run_until_complete(self.close()) - return - loop.create_task(self.close()) - def prepare_value(self, value: Any) -> Union[str, int, bool]: if isinstance(value, str): return value diff --git a/aiogram/api/methods/base.py b/aiogram/api/methods/base.py index 6ed25176..ea39de93 100644 --- a/aiogram/api/methods/base.py +++ b/aiogram/api/methods/base.py @@ -9,7 +9,7 @@ from pydantic.generics import GenericModel from ..types import InputFile, ResponseParameters -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot T = TypeVar("T") @@ -42,11 +42,11 @@ class TelegramMethod(abc.ABC, BaseModel, Generic[T]): @property @abc.abstractmethod - def __returning__(self) -> Type: + def __returning__(self) -> Type: # pragma: no cover pass @abc.abstractmethod - def build_request(self) -> Request: + def build_request(self) -> Request: # pragma: no cover pass def build_response(self, data: Dict[str, Any]) -> Response[T]: diff --git a/aiogram/api/types/animation.py b/aiogram/api/types/animation.py index c4b2e7c4..9f9c8db4 100644 --- a/aiogram/api/types/animation.py +++ b/aiogram/api/types/animation.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize diff --git a/aiogram/api/types/audio.py b/aiogram/api/types/audio.py index 6c8c66ec..ce690e9b 100644 --- a/aiogram/api/types/audio.py +++ b/aiogram/api/types/audio.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize diff --git a/aiogram/api/types/callback_query.py b/aiogram/api/types/callback_query.py index 042d26d8..dae35ce9 100644 --- a/aiogram/api/types/callback_query.py +++ b/aiogram/api/types/callback_query.py @@ -6,7 +6,7 @@ from pydantic import Field from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .user import User from .message import Message diff --git a/aiogram/api/types/chat.py b/aiogram/api/types/chat.py index df5b9991..23b79f31 100644 --- a/aiogram/api/types/chat.py +++ b/aiogram/api/types/chat.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .chat_photo import ChatPhoto from .message import Message from .chat_permissions import ChatPermissions diff --git a/aiogram/api/types/chat_member.py b/aiogram/api/types/chat_member.py index b9311d1e..b7662e5a 100644 --- a/aiogram/api/types/chat_member.py +++ b/aiogram/api/types/chat_member.py @@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Optional, Union from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .user import User diff --git a/aiogram/api/types/chosen_inline_result.py b/aiogram/api/types/chosen_inline_result.py index 270fbecb..9e1fac63 100644 --- a/aiogram/api/types/chosen_inline_result.py +++ b/aiogram/api/types/chosen_inline_result.py @@ -6,7 +6,7 @@ from pydantic import Field from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .user import User from .location import Location diff --git a/aiogram/api/types/document.py b/aiogram/api/types/document.py index 4d01f7cb..39ed3552 100644 --- a/aiogram/api/types/document.py +++ b/aiogram/api/types/document.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize diff --git a/aiogram/api/types/encrypted_passport_element.py b/aiogram/api/types/encrypted_passport_element.py index 7ce66e0a..2e786009 100644 --- a/aiogram/api/types/encrypted_passport_element.py +++ b/aiogram/api/types/encrypted_passport_element.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .passport_file import PassportFile diff --git a/aiogram/api/types/game.py b/aiogram/api/types/game.py index 899e8030..a4caf9c9 100644 --- a/aiogram/api/types/game.py +++ b/aiogram/api/types/game.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize from .message_entity import MessageEntity from .animation import Animation diff --git a/aiogram/api/types/game_high_score.py b/aiogram/api/types/game_high_score.py index e4b3ccaf..af8a1f3a 100644 --- a/aiogram/api/types/game_high_score.py +++ b/aiogram/api/types/game_high_score.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .user import User diff --git a/aiogram/api/types/inline_keyboard_button.py b/aiogram/api/types/inline_keyboard_button.py index 46372a17..6ef9fa8b 100644 --- a/aiogram/api/types/inline_keyboard_button.py +++ b/aiogram/api/types/inline_keyboard_button.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .callback_game import CallbackGame from .login_url import LoginUrl diff --git a/aiogram/api/types/inline_keyboard_markup.py b/aiogram/api/types/inline_keyboard_markup.py index 6c83cb9a..b2bd2be4 100644 --- a/aiogram/api/types/inline_keyboard_markup.py +++ b/aiogram/api/types/inline_keyboard_markup.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .inline_keyboard_button import InlineKeyboardButton diff --git a/aiogram/api/types/inline_query.py b/aiogram/api/types/inline_query.py index 203f8372..57576c23 100644 --- a/aiogram/api/types/inline_query.py +++ b/aiogram/api/types/inline_query.py @@ -6,7 +6,7 @@ from pydantic import Field from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .user import User from .location import Location diff --git a/aiogram/api/types/inline_query_result_article.py b/aiogram/api/types/inline_query_result_article.py index 4af454c5..776bfc8c 100644 --- a/aiogram/api/types/inline_query_result_article.py +++ b/aiogram/api/types/inline_query_result_article.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_audio.py b/aiogram/api/types/inline_query_result_audio.py index d9fbe701..3a42ff08 100644 --- a/aiogram/api/types/inline_query_result_audio.py +++ b/aiogram/api/types/inline_query_result_audio.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_audio.py b/aiogram/api/types/inline_query_result_cached_audio.py index 3a8c65ad..941750d6 100644 --- a/aiogram/api/types/inline_query_result_cached_audio.py +++ b/aiogram/api/types/inline_query_result_cached_audio.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_document.py b/aiogram/api/types/inline_query_result_cached_document.py index f7c525b9..6299228b 100644 --- a/aiogram/api/types/inline_query_result_cached_document.py +++ b/aiogram/api/types/inline_query_result_cached_document.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_gif.py b/aiogram/api/types/inline_query_result_cached_gif.py index 08d0913d..b30c190c 100644 --- a/aiogram/api/types/inline_query_result_cached_gif.py +++ b/aiogram/api/types/inline_query_result_cached_gif.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py b/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py index 63065043..9b3a0bc8 100644 --- a/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py +++ b/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_photo.py b/aiogram/api/types/inline_query_result_cached_photo.py index b28adf33..9f518f02 100644 --- a/aiogram/api/types/inline_query_result_cached_photo.py +++ b/aiogram/api/types/inline_query_result_cached_photo.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_sticker.py b/aiogram/api/types/inline_query_result_cached_sticker.py index a24a52b9..d91284d2 100644 --- a/aiogram/api/types/inline_query_result_cached_sticker.py +++ b/aiogram/api/types/inline_query_result_cached_sticker.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_video.py b/aiogram/api/types/inline_query_result_cached_video.py index e35f43c4..b415dd6b 100644 --- a/aiogram/api/types/inline_query_result_cached_video.py +++ b/aiogram/api/types/inline_query_result_cached_video.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_cached_voice.py b/aiogram/api/types/inline_query_result_cached_voice.py index 30ea495b..5b267b43 100644 --- a/aiogram/api/types/inline_query_result_cached_voice.py +++ b/aiogram/api/types/inline_query_result_cached_voice.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_contact.py b/aiogram/api/types/inline_query_result_contact.py index 6637dc50..00c85b0b 100644 --- a/aiogram/api/types/inline_query_result_contact.py +++ b/aiogram/api/types/inline_query_result_contact.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_document.py b/aiogram/api/types/inline_query_result_document.py index c1dfef53..a71df0e6 100644 --- a/aiogram/api/types/inline_query_result_document.py +++ b/aiogram/api/types/inline_query_result_document.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_game.py b/aiogram/api/types/inline_query_result_game.py index 708c7ebf..5ddc7222 100644 --- a/aiogram/api/types/inline_query_result_game.py +++ b/aiogram/api/types/inline_query_result_game.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_gif.py b/aiogram/api/types/inline_query_result_gif.py index 65ac888a..bcc32338 100644 --- a/aiogram/api/types/inline_query_result_gif.py +++ b/aiogram/api/types/inline_query_result_gif.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_location.py b/aiogram/api/types/inline_query_result_location.py index 13bdb194..e51aa96c 100644 --- a/aiogram/api/types/inline_query_result_location.py +++ b/aiogram/api/types/inline_query_result_location.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_mpeg4_gif.py b/aiogram/api/types/inline_query_result_mpeg4_gif.py index e2e80fb8..a73c667f 100644 --- a/aiogram/api/types/inline_query_result_mpeg4_gif.py +++ b/aiogram/api/types/inline_query_result_mpeg4_gif.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_photo.py b/aiogram/api/types/inline_query_result_photo.py index 9161ce82..00bc9153 100644 --- a/aiogram/api/types/inline_query_result_photo.py +++ b/aiogram/api/types/inline_query_result_photo.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_venue.py b/aiogram/api/types/inline_query_result_venue.py index abde29ef..e441a4cd 100644 --- a/aiogram/api/types/inline_query_result_venue.py +++ b/aiogram/api/types/inline_query_result_venue.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_video.py b/aiogram/api/types/inline_query_result_video.py index 592ff060..8ebffeb9 100644 --- a/aiogram/api/types/inline_query_result_video.py +++ b/aiogram/api/types/inline_query_result_video.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/inline_query_result_voice.py b/aiogram/api/types/inline_query_result_voice.py index 7a4d5bdc..831fb496 100644 --- a/aiogram/api/types/inline_query_result_voice.py +++ b/aiogram/api/types/inline_query_result_voice.py @@ -6,7 +6,7 @@ from pydantic import Field from .inline_query_result import InlineQueryResult -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_message_content import InputMessageContent from .inline_keyboard_markup import InlineKeyboardMarkup diff --git a/aiogram/api/types/input_file.py b/aiogram/api/types/input_file.py index 9887b85c..d6ec7d81 100644 --- a/aiogram/api/types/input_file.py +++ b/aiogram/api/types/input_file.py @@ -28,7 +28,7 @@ class InputFile(ABC): yield @abstractmethod - async def read(self, chunk_size: int) -> AsyncGenerator[bytes, None]: + async def read(self, chunk_size: int) -> AsyncGenerator[bytes, None]: # pragma: no cover yield b"" async def __aiter__(self): diff --git a/aiogram/api/types/input_media_animation.py b/aiogram/api/types/input_media_animation.py index d8226998..5e4439b4 100644 --- a/aiogram/api/types/input_media_animation.py +++ b/aiogram/api/types/input_media_animation.py @@ -6,7 +6,7 @@ from pydantic import Field from .input_media import InputMedia -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_file import InputFile diff --git a/aiogram/api/types/input_media_audio.py b/aiogram/api/types/input_media_audio.py index 23f8e190..73bba3be 100644 --- a/aiogram/api/types/input_media_audio.py +++ b/aiogram/api/types/input_media_audio.py @@ -6,7 +6,7 @@ from pydantic import Field from .input_media import InputMedia -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_file import InputFile diff --git a/aiogram/api/types/input_media_document.py b/aiogram/api/types/input_media_document.py index 56a275aa..1c9d2b31 100644 --- a/aiogram/api/types/input_media_document.py +++ b/aiogram/api/types/input_media_document.py @@ -6,7 +6,7 @@ from pydantic import Field from .input_media import InputMedia -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_file import InputFile diff --git a/aiogram/api/types/input_media_photo.py b/aiogram/api/types/input_media_photo.py index 1ecc3a4d..60b9227c 100644 --- a/aiogram/api/types/input_media_photo.py +++ b/aiogram/api/types/input_media_photo.py @@ -6,7 +6,7 @@ from pydantic import Field from .input_media import InputMedia -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_file import InputFile diff --git a/aiogram/api/types/input_media_video.py b/aiogram/api/types/input_media_video.py index 121132db..4537fa80 100644 --- a/aiogram/api/types/input_media_video.py +++ b/aiogram/api/types/input_media_video.py @@ -6,7 +6,7 @@ from pydantic import Field from .input_media import InputMedia -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .input_file import InputFile diff --git a/aiogram/api/types/message.py b/aiogram/api/types/message.py index 973a77cd..56b35579 100644 --- a/aiogram/api/types/message.py +++ b/aiogram/api/types/message.py @@ -7,7 +7,7 @@ from pydantic import Field from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize from .location import Location from .contact import Contact diff --git a/aiogram/api/types/message_entity.py b/aiogram/api/types/message_entity.py index 431d57d9..b8166b3f 100644 --- a/aiogram/api/types/message_entity.py +++ b/aiogram/api/types/message_entity.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .user import User diff --git a/aiogram/api/types/order_info.py b/aiogram/api/types/order_info.py index d84f8b0e..f96bc4cc 100644 --- a/aiogram/api/types/order_info.py +++ b/aiogram/api/types/order_info.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .shipping_address import ShippingAddress diff --git a/aiogram/api/types/passport_data.py b/aiogram/api/types/passport_data.py index 2c732e71..f6e84ce8 100644 --- a/aiogram/api/types/passport_data.py +++ b/aiogram/api/types/passport_data.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .encrypted_passport_element import EncryptedPassportElement from .encrypted_credentials import EncryptedCredentials diff --git a/aiogram/api/types/poll.py b/aiogram/api/types/poll.py index 30f3da1d..1ee74656 100644 --- a/aiogram/api/types/poll.py +++ b/aiogram/api/types/poll.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .poll_option import PollOption diff --git a/aiogram/api/types/pre_checkout_query.py b/aiogram/api/types/pre_checkout_query.py index 4b0fbb79..b3daab57 100644 --- a/aiogram/api/types/pre_checkout_query.py +++ b/aiogram/api/types/pre_checkout_query.py @@ -6,7 +6,7 @@ from pydantic import Field from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .order_info import OrderInfo from .user import User diff --git a/aiogram/api/types/reply_keyboard_markup.py b/aiogram/api/types/reply_keyboard_markup.py index e1dce229..acda3c81 100644 --- a/aiogram/api/types/reply_keyboard_markup.py +++ b/aiogram/api/types/reply_keyboard_markup.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .keyboard_button import KeyboardButton diff --git a/aiogram/api/types/shipping_option.py b/aiogram/api/types/shipping_option.py index 6caa84a5..dca70afd 100644 --- a/aiogram/api/types/shipping_option.py +++ b/aiogram/api/types/shipping_option.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .labeled_price import LabeledPrice diff --git a/aiogram/api/types/shipping_query.py b/aiogram/api/types/shipping_query.py index 8b6e2ea4..8129e1a4 100644 --- a/aiogram/api/types/shipping_query.py +++ b/aiogram/api/types/shipping_query.py @@ -6,7 +6,7 @@ from pydantic import Field from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .user import User from .shipping_address import ShippingAddress diff --git a/aiogram/api/types/sticker.py b/aiogram/api/types/sticker.py index a92f5d98..1eb98599 100644 --- a/aiogram/api/types/sticker.py +++ b/aiogram/api/types/sticker.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize from .mask_position import MaskPosition diff --git a/aiogram/api/types/sticker_set.py b/aiogram/api/types/sticker_set.py index 05917c32..cec9b3be 100644 --- a/aiogram/api/types/sticker_set.py +++ b/aiogram/api/types/sticker_set.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .sticker import Sticker diff --git a/aiogram/api/types/successful_payment.py b/aiogram/api/types/successful_payment.py index cb31356b..d4105472 100644 --- a/aiogram/api/types/successful_payment.py +++ b/aiogram/api/types/successful_payment.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .order_info import OrderInfo diff --git a/aiogram/api/types/update.py b/aiogram/api/types/update.py index 57351a8b..90c468f4 100644 --- a/aiogram/api/types/update.py +++ b/aiogram/api/types/update.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .inline_query import InlineQuery from .shipping_query import ShippingQuery from .message import Message diff --git a/aiogram/api/types/user_profile_photos.py b/aiogram/api/types/user_profile_photos.py index ad1197bf..8741bfd8 100644 --- a/aiogram/api/types/user_profile_photos.py +++ b/aiogram/api/types/user_profile_photos.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize diff --git a/aiogram/api/types/venue.py b/aiogram/api/types/venue.py index f2853b05..4e8769ab 100644 --- a/aiogram/api/types/venue.py +++ b/aiogram/api/types/venue.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .location import Location diff --git a/aiogram/api/types/video.py b/aiogram/api/types/video.py index 34bb658c..acd3a303 100644 --- a/aiogram/api/types/video.py +++ b/aiogram/api/types/video.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize diff --git a/aiogram/api/types/video_note.py b/aiogram/api/types/video_note.py index d81c2f2b..184087ba 100644 --- a/aiogram/api/types/video_note.py +++ b/aiogram/api/types/video_note.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .photo_size import PhotoSize diff --git a/tests/test_api/test_client/test_session/test_base_session.py b/tests/test_api/test_client/test_session/test_base_session.py index 80422124..94bb92f4 100644 --- a/tests/test_api/test_client/test_session/test_base_session.py +++ b/tests/test_api/test_client/test_session/test_base_session.py @@ -1,9 +1,6 @@ import datetime -from unittest.mock import patch import pytest -import pytz -from asynctest import CoroutineMock from aiogram.api.client.session.base import BaseSession from aiogram.api.client.telegram import PRODUCTION, TelegramAPIServer @@ -31,25 +28,6 @@ class TestBaseSession(DataMixin): session = BaseSession(api=api) assert session.api == api - def test_sync_close(self): - session = BaseSession() - - with patch( - "aiogram.api.client.session.base.BaseSession.close", new=CoroutineMock() - ) as mocked_close: - session.__del__() - mocked_close.assert_called_once_with() - - @pytest.mark.asyncio - async def test_async_close(self): - session = BaseSession() - - with patch( - "aiogram.api.client.session.base.BaseSession.close", new=CoroutineMock() - ) as mocked_close: - session.__del__() - mocked_close.assert_called_once() - def test_prepare_value(self): session = BaseSession()