mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-10 17:53:17 +00:00
No cover if TYPE_CHECKING
This commit is contained in:
parent
c9e490bcee
commit
0acdb24c3c
60 changed files with 60 additions and 100 deletions
|
|
@ -2,14 +2,7 @@ from .api import methods, types
|
||||||
from .api.client import session
|
from .api.client import session
|
||||||
from .api.client.bot import Bot
|
from .api.client.bot import Bot
|
||||||
|
|
||||||
try:
|
__all__ = ("__api_version__", "__version__", "types", "methods", "Bot", "session")
|
||||||
import uvloop
|
|
||||||
|
|
||||||
uvloop.install()
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
__all__ = ["__api_version__", "__version__", "types", "methods", "Bot", "session"]
|
|
||||||
|
|
||||||
__version__ = "3.0.0a0"
|
__version__ = "3.0.0a0"
|
||||||
__api_version__ = "4.4"
|
__api_version__ = "4.4"
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,6 @@ class BaseSession(abc.ABC):
|
||||||
async def make_request(self, token: str, method: TelegramMethod[T]) -> T:
|
async def make_request(self, token: str, method: TelegramMethod[T]) -> T:
|
||||||
pass
|
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]:
|
def prepare_value(self, value: Any) -> Union[str, int, bool]:
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
return value
|
return value
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from pydantic.generics import GenericModel
|
||||||
|
|
||||||
from ..types import InputFile, ResponseParameters
|
from ..types import InputFile, ResponseParameters
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from ..client.bot import Bot
|
from ..client.bot import Bot
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
@ -42,11 +42,11 @@ class TelegramMethod(abc.ABC, BaseModel, Generic[T]):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def __returning__(self) -> Type:
|
def __returning__(self) -> Type: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def build_request(self) -> Request:
|
def build_request(self) -> Request: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def build_response(self, data: Dict[str, Any]) -> Response[T]:
|
def build_response(self, data: Dict[str, Any]) -> Response[T]:
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .user import User
|
from .user import User
|
||||||
from .message import Message
|
from .message import Message
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .chat_photo import ChatPhoto
|
from .chat_photo import ChatPhoto
|
||||||
from .message import Message
|
from .message import Message
|
||||||
from .chat_permissions import ChatPermissions
|
from .chat_permissions import ChatPermissions
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Optional, Union
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .user import User
|
from .user import User
|
||||||
from .location import Location
|
from .location import Location
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .passport_file import PassportFile
|
from .passport_file import PassportFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
from .message_entity import MessageEntity
|
from .message_entity import MessageEntity
|
||||||
from .animation import Animation
|
from .animation import Animation
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .callback_game import CallbackGame
|
from .callback_game import CallbackGame
|
||||||
from .login_url import LoginUrl
|
from .login_url import LoginUrl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .inline_keyboard_button import InlineKeyboardButton
|
from .inline_keyboard_button import InlineKeyboardButton
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .user import User
|
from .user import User
|
||||||
from .location import Location
|
from .location import Location
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .inline_query_result import InlineQueryResult
|
from .inline_query_result import InlineQueryResult
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_message_content import InputMessageContent
|
from .input_message_content import InputMessageContent
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class InputFile(ABC):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
@abstractmethod
|
@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""
|
yield b""
|
||||||
|
|
||||||
async def __aiter__(self):
|
async def __aiter__(self):
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .input_media import InputMedia
|
from .input_media import InputMedia
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_file import InputFile
|
from .input_file import InputFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .input_media import InputMedia
|
from .input_media import InputMedia
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_file import InputFile
|
from .input_file import InputFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .input_media import InputMedia
|
from .input_media import InputMedia
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_file import InputFile
|
from .input_file import InputFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .input_media import InputMedia
|
from .input_media import InputMedia
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_file import InputFile
|
from .input_file import InputFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .input_media import InputMedia
|
from .input_media import InputMedia
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .input_file import InputFile
|
from .input_file import InputFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
from .location import Location
|
from .location import Location
|
||||||
from .contact import Contact
|
from .contact import Contact
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .shipping_address import ShippingAddress
|
from .shipping_address import ShippingAddress
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .encrypted_passport_element import EncryptedPassportElement
|
from .encrypted_passport_element import EncryptedPassportElement
|
||||||
from .encrypted_credentials import EncryptedCredentials
|
from .encrypted_credentials import EncryptedCredentials
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .poll_option import PollOption
|
from .poll_option import PollOption
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .order_info import OrderInfo
|
from .order_info import OrderInfo
|
||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .keyboard_button import KeyboardButton
|
from .keyboard_button import KeyboardButton
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .labeled_price import LabeledPrice
|
from .labeled_price import LabeledPrice
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .user import User
|
from .user import User
|
||||||
from .shipping_address import ShippingAddress
|
from .shipping_address import ShippingAddress
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
from .mask_position import MaskPosition
|
from .mask_position import MaskPosition
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .sticker import Sticker
|
from .sticker import Sticker
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .order_info import OrderInfo
|
from .order_info import OrderInfo
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .inline_query import InlineQuery
|
from .inline_query import InlineQuery
|
||||||
from .shipping_query import ShippingQuery
|
from .shipping_query import ShippingQuery
|
||||||
from .message import Message
|
from .message import Message
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .location import Location
|
from .location import Location
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from .photo_size import PhotoSize
|
from .photo_size import PhotoSize
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
import datetime
|
import datetime
|
||||||
from unittest.mock import patch
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import pytz
|
|
||||||
from asynctest import CoroutineMock
|
|
||||||
|
|
||||||
from aiogram.api.client.session.base import BaseSession
|
from aiogram.api.client.session.base import BaseSession
|
||||||
from aiogram.api.client.telegram import PRODUCTION, TelegramAPIServer
|
from aiogram.api.client.telegram import PRODUCTION, TelegramAPIServer
|
||||||
|
|
@ -31,25 +28,6 @@ class TestBaseSession(DataMixin):
|
||||||
session = BaseSession(api=api)
|
session = BaseSession(api=api)
|
||||||
assert session.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):
|
def test_prepare_value(self):
|
||||||
session = BaseSession()
|
session = BaseSession()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue