mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
sort imports
This commit is contained in:
parent
57c6766514
commit
f589a1269a
110 changed files with 203 additions and 238 deletions
|
|
@ -27,6 +27,7 @@ class FakeTelegram(aresponses.ResponsesMockServer):
|
|||
@staticmethod
|
||||
def parse_data(message_data):
|
||||
import json
|
||||
|
||||
from aiogram.utils.payload import _normalize
|
||||
|
||||
_body = '{"ok":true,"result":' + json.dumps(_normalize(message_data)) + '}'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import aioredis.util
|
||||
import pytest
|
||||
from _pytest.config import UsageError
|
||||
import aioredis.util
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import pytest
|
||||
|
||||
from aiogram import Bot, types
|
||||
from . import FakeTelegram, TOKEN, BOT_ID
|
||||
|
||||
from . import BOT_ID, TOKEN, FakeTelegram
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
|
@ -151,7 +152,7 @@ async def test_send_media_group(bot: Bot, event_loop):
|
|||
|
||||
async def test_send_location(bot: Bot, event_loop):
|
||||
""" sendLocation method test """
|
||||
from .types.dataset import MESSAGE_WITH_LOCATION, LOCATION
|
||||
from .types.dataset import LOCATION, MESSAGE_WITH_LOCATION
|
||||
msg = types.Message(**MESSAGE_WITH_LOCATION)
|
||||
location = types.Location(**LOCATION)
|
||||
|
||||
|
|
@ -163,7 +164,7 @@ async def test_send_location(bot: Bot, event_loop):
|
|||
|
||||
async def test_edit_message_live_location_by_bot(bot: Bot, event_loop):
|
||||
""" editMessageLiveLocation method test """
|
||||
from .types.dataset import MESSAGE_WITH_LOCATION, LOCATION
|
||||
from .types.dataset import LOCATION, MESSAGE_WITH_LOCATION
|
||||
msg = types.Message(**MESSAGE_WITH_LOCATION)
|
||||
location = types.Location(**LOCATION)
|
||||
|
||||
|
|
@ -176,7 +177,7 @@ async def test_edit_message_live_location_by_bot(bot: Bot, event_loop):
|
|||
|
||||
async def test_edit_message_live_location_by_user(bot: Bot, event_loop):
|
||||
""" editMessageLiveLocation method test """
|
||||
from .types.dataset import MESSAGE_WITH_LOCATION, LOCATION
|
||||
from .types.dataset import LOCATION, MESSAGE_WITH_LOCATION
|
||||
msg = types.Message(**MESSAGE_WITH_LOCATION)
|
||||
location = types.Location(**LOCATION)
|
||||
|
||||
|
|
@ -212,7 +213,7 @@ async def test_stop_message_live_location_by_user(bot: Bot, event_loop):
|
|||
|
||||
async def test_send_venue(bot: Bot, event_loop):
|
||||
""" sendVenue method test """
|
||||
from .types.dataset import MESSAGE_WITH_VENUE, VENUE, LOCATION
|
||||
from .types.dataset import LOCATION, MESSAGE_WITH_VENUE, VENUE
|
||||
msg = types.Message(**MESSAGE_WITH_VENUE)
|
||||
location = types.Location(**LOCATION)
|
||||
venue = types.Venue(**VENUE)
|
||||
|
|
@ -226,7 +227,7 @@ async def test_send_venue(bot: Bot, event_loop):
|
|||
|
||||
async def test_send_contact(bot: Bot, event_loop):
|
||||
""" sendContact method test """
|
||||
from .types.dataset import MESSAGE_WITH_CONTACT, CONTACT
|
||||
from .types.dataset import CONTACT, MESSAGE_WITH_CONTACT
|
||||
msg = types.Message(**MESSAGE_WITH_CONTACT)
|
||||
contact = types.Contact(**CONTACT)
|
||||
|
||||
|
|
@ -259,7 +260,7 @@ async def test_send_chat_action(bot: Bot, event_loop):
|
|||
|
||||
async def test_get_user_profile_photo(bot: Bot, event_loop):
|
||||
""" getUserProfilePhotos method test """
|
||||
from .types.dataset import USER_PROFILE_PHOTOS, USER
|
||||
from .types.dataset import USER, USER_PROFILE_PHOTOS
|
||||
user = types.User(**USER)
|
||||
|
||||
async with FakeTelegram(message_data=USER_PROFILE_PHOTOS, loop=event_loop):
|
||||
|
|
@ -279,7 +280,7 @@ async def test_get_file(bot: Bot, event_loop):
|
|||
|
||||
async def test_kick_chat_member(bot: Bot, event_loop):
|
||||
""" kickChatMember method test """
|
||||
from .types.dataset import USER, CHAT
|
||||
from .types.dataset import CHAT, USER
|
||||
user = types.User(**USER)
|
||||
chat = types.Chat(**CHAT)
|
||||
|
||||
|
|
@ -291,7 +292,7 @@ async def test_kick_chat_member(bot: Bot, event_loop):
|
|||
|
||||
async def test_unban_chat_member(bot: Bot, event_loop):
|
||||
""" unbanChatMember method test """
|
||||
from .types.dataset import USER, CHAT
|
||||
from .types.dataset import CHAT, USER
|
||||
user = types.User(**USER)
|
||||
chat = types.Chat(**CHAT)
|
||||
|
||||
|
|
@ -303,7 +304,7 @@ async def test_unban_chat_member(bot: Bot, event_loop):
|
|||
|
||||
async def test_restrict_chat_member(bot: Bot, event_loop):
|
||||
""" restrictChatMember method test """
|
||||
from .types.dataset import USER, CHAT
|
||||
from .types.dataset import CHAT, USER
|
||||
user = types.User(**USER)
|
||||
chat = types.Chat(**CHAT)
|
||||
|
||||
|
|
@ -323,7 +324,7 @@ async def test_restrict_chat_member(bot: Bot, event_loop):
|
|||
|
||||
async def test_promote_chat_member(bot: Bot, event_loop):
|
||||
""" promoteChatMember method test """
|
||||
from .types.dataset import USER, CHAT
|
||||
from .types.dataset import CHAT, USER
|
||||
user = types.User(**USER)
|
||||
chat = types.Chat(**CHAT)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ from aiogram.bot.base import BaseBot
|
|||
try:
|
||||
from asynctest import CoroutineMock, patch
|
||||
except ImportError:
|
||||
from unittest.mock import AsyncMock as CoroutineMock, patch # type: ignore
|
||||
from unittest.mock import AsyncMock as CoroutineMock # type: ignore
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestAiohttpSession:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from aiogram import Dispatcher, Bot
|
||||
from aiogram import Bot, Dispatcher
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
from typing import Set
|
||||
from datetime import datetime
|
||||
from typing import Set
|
||||
|
||||
import pytest
|
||||
|
||||
from aiogram.dispatcher.filters.builtin import (
|
||||
Text,
|
||||
extract_chat_ids,
|
||||
ChatIDArgumentType, ForwardedMessageFilter, IDFilter,
|
||||
)
|
||||
from aiogram.dispatcher.filters.builtin import (ChatIDArgumentType,
|
||||
ForwardedMessageFilter,
|
||||
IDFilter, Text,
|
||||
extract_chat_ids)
|
||||
from aiogram.types import Message
|
||||
from tests.types.dataset import MESSAGE, MESSAGE_FROM_CHANNEL
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from aiogram.dispatcher.filters.state import StatesGroup
|
||||
|
||||
|
||||
class TestStatesGroup:
|
||||
|
||||
def test_all_childs(self):
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from typing import Match
|
|||
|
||||
import pytest
|
||||
|
||||
from aiogram.dispatcher.filters import Text, CommandStart
|
||||
from aiogram.types import Message, CallbackQuery, InlineQuery, Poll
|
||||
from aiogram.dispatcher.filters import CommandStart, Text
|
||||
from aiogram.types import CallbackQuery, InlineQuery, Message, Poll
|
||||
|
||||
# enable asyncio mode
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ from asyncio import BaseEventLoop
|
|||
import pytest
|
||||
|
||||
from aiogram import Bot, types
|
||||
from . import FakeTelegram, TOKEN
|
||||
|
||||
from . import TOKEN, FakeTelegram
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.dispatcher.filters.state import State, StatesGroup, any_state, default_state
|
||||
from aiogram.dispatcher.filters.state import (State, StatesGroup, any_state,
|
||||
default_state)
|
||||
|
||||
|
||||
class MyGroup(StatesGroup):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.utils.auth_widget import check_integrity, \
|
||||
generate_hash, check_token
|
||||
from aiogram.utils.auth_widget import (check_integrity, check_token,
|
||||
generate_hash)
|
||||
|
||||
TOKEN = '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.utils.deep_linking import decode_payload, encode_payload, filter_payload
|
||||
from aiogram.utils.deep_linking import get_start_link, get_startgroup_link
|
||||
from aiogram.utils.deep_linking import (decode_payload, encode_payload,
|
||||
filter_payload, get_start_link,
|
||||
get_startgroup_link)
|
||||
from tests.types import dataset
|
||||
|
||||
# enable asyncio mode
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from aiogram.utils.helper import OrderedHelper, Item, ListItem
|
||||
from aiogram.utils.helper import Item, ListItem, OrderedHelper
|
||||
|
||||
|
||||
class TestOrderedHelper:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import ANIMATION
|
||||
|
||||
animation = types.Animation(**ANIMATION)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import CHAT
|
||||
|
||||
chat = types.Chat(**CHAT)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import CHAT_MEMBER
|
||||
|
||||
chat_member = types.ChatMember(**CHAT_MEMBER)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import DOCUMENT
|
||||
|
||||
document = types.Document(**DOCUMENT)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import GAME
|
||||
|
||||
game = types.Game(**GAME)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from aiogram import types
|
||||
from .dataset import AUDIO, ANIMATION, \
|
||||
DOCUMENT, PHOTO, VIDEO
|
||||
|
||||
from .dataset import ANIMATION, AUDIO, DOCUMENT, PHOTO, VIDEO
|
||||
|
||||
WIDTH = 'width'
|
||||
HEIGHT = 'height'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import datetime
|
||||
|
||||
from aiogram import types
|
||||
|
||||
from .dataset import MESSAGE
|
||||
|
||||
message = types.Message(**MESSAGE)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import PHOTO
|
||||
|
||||
photo = types.PhotoSize(**PHOTO)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import REPLY_KEYBOARD_MARKUP
|
||||
|
||||
reply_keyboard = types.ReplyKeyboardMarkup(**REPLY_KEYBOARD_MARKUP)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from aiogram import types
|
||||
|
||||
from .dataset import UPDATE
|
||||
|
||||
update = types.Update(**UPDATE)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from babel import Locale
|
||||
|
||||
from aiogram import types
|
||||
|
||||
from .dataset import USER
|
||||
|
||||
user = types.User(**USER)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue