Dev 3.x flat package (#961)

* Move packages

* Added changelog

* Update examples/echo_bot.py

Co-authored-by: Oleg A. <t0rr@mail.ru>

* Rename `handler` -> `handlers`

* Update __init__.py

Co-authored-by: Oleg A. <t0rr@mail.ru>
This commit is contained in:
Alex Root Junior 2022-08-14 01:07:52 +03:00 committed by GitHub
parent 5e7932ca20
commit 4315ecf1a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
111 changed files with 376 additions and 390 deletions

View file

@ -5,12 +5,8 @@ from _pytest.config import UsageError
from redis.asyncio.connection import parse_url as parse_redis_url
from aiogram import Bot, Dispatcher
from aiogram.dispatcher.fsm.storage.memory import (
DisabledEventIsolation,
MemoryStorage,
SimpleEventIsolation,
)
from aiogram.dispatcher.fsm.storage.redis import RedisEventIsolation, RedisStorage
from aiogram.fsm.storage.memory import DisabledEventIsolation, MemoryStorage, SimpleEventIsolation
from aiogram.fsm.storage.redis import RedisEventIsolation, RedisStorage
from tests.mocked_bot import MockedBot
DATA_DIR = Path(__file__).parent / "data"

View file

@ -5,8 +5,8 @@ import pytest
from aiogram import F
from aiogram.dispatcher.event.handler import CallableMixin, FilterObject, HandlerObject
from aiogram.dispatcher.filters.base import BaseFilter
from aiogram.dispatcher.handler.base import BaseHandler
from aiogram.filters import BaseFilter
from aiogram.handlers import BaseHandler
from aiogram.types import Update
pytestmark = pytest.mark.asyncio

View file

@ -7,9 +7,9 @@ import pytest
from aiogram.dispatcher.event.bases import REJECTED, SkipHandler
from aiogram.dispatcher.event.handler import HandlerObject
from aiogram.dispatcher.event.telegram import TelegramEventObserver
from aiogram.dispatcher.filters.base import BaseFilter
from aiogram.dispatcher.router import Router
from aiogram.exceptions import FiltersResolveError
from aiogram.filters import BaseFilter
from aiogram.types import Chat, Message, User
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Awaitable
import pytest
from aiogram.dispatcher.filters.base import BaseFilter
from aiogram.filters import BaseFilter
try:
from asynctest import CoroutineMock, patch
@ -27,7 +27,7 @@ class TestBaseFilter:
assert isinstance(my_filter, Awaitable)
with patch(
"tests.test_dispatcher.test_filters.test_base.MyFilter.__call__",
"tests.test_filters.test_base.MyFilter.__call__",
new_callable=CoroutineMock,
) as mocked_call:
call = my_filter(event="test")

View file

@ -9,7 +9,7 @@ from magic_filter import MagicFilter
from pydantic import ValidationError
from aiogram import F
from aiogram.dispatcher.filters.callback_data import CallbackData
from aiogram.filters.callback_data import CallbackData
from aiogram.types import CallbackQuery, User
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from datetime import datetime
import pytest
from aiogram.dispatcher.filters.chat_member_updated import (
from aiogram.filters.chat_member_updated import (
ADMINISTRATOR,
IS_MEMBER,
JOIN_TRANSITION,

View file

@ -4,8 +4,8 @@ import re
import pytest
from aiogram import F
from aiogram.dispatcher.filters import Command, CommandObject
from aiogram.dispatcher.filters.command import CommandStart
from aiogram.filters import Command, CommandObject
from aiogram.filters.command import CommandStart
from aiogram.types import Chat, Message, User
from tests.mocked_bot import MockedBot

View file

@ -4,7 +4,7 @@ from typing import cast
import pytest
from pydantic import ValidationError
from aiogram.dispatcher.filters import ContentTypesFilter
from aiogram.filters import ContentTypesFilter
from aiogram.types import ContentType, Message
pytestmark = pytest.mark.asyncio

View file

@ -3,7 +3,7 @@ import re
import pytest
from aiogram import Dispatcher
from aiogram.dispatcher.filters import ExceptionMessageFilter, ExceptionTypeFilter
from aiogram.filters import ExceptionMessageFilter, ExceptionTypeFilter
from aiogram.types import Update
pytestmark = pytest.mark.asyncio

View file

@ -1,7 +1,7 @@
import pytest
from aiogram.dispatcher.filters import Text, and_f, invert_f, or_f
from aiogram.dispatcher.filters.logic import _AndFilter, _InvertFilter, _OrFilter
from aiogram.filters import Text, and_f, invert_f, or_f
from aiogram.filters.logic import _AndFilter, _InvertFilter, _OrFilter
class TestLogic:

View file

@ -2,7 +2,7 @@ import pytest
from magic_filter import AttrDict
from aiogram import F
from aiogram.dispatcher.filters import MagicData
from aiogram.filters import MagicData
from aiogram.types import Update

View file

@ -4,8 +4,8 @@ from inspect import isclass
import pytest
from aiogram.dispatcher.event.handler import FilterObject
from aiogram.dispatcher.filters import StateFilter
from aiogram.dispatcher.fsm.state import State, StatesGroup
from aiogram.filters import StateFilter
from aiogram.fsm.state import State, StatesGroup
from aiogram.types import Update
pytestmark = pytest.mark.asyncio

View file

@ -5,8 +5,7 @@ from typing import Sequence, Type
import pytest
from pydantic import ValidationError
from aiogram.dispatcher.filters import BUILTIN_FILTERS
from aiogram.dispatcher.filters.text import Text
from aiogram.filters import BUILTIN_FILTERS, Text
from aiogram.types import CallbackQuery, Chat, InlineQuery, Message, Poll, PollOption, User
pytestmark = pytest.mark.asyncio

View file

@ -1,6 +1,6 @@
import pytest
from aiogram.dispatcher.flags.flag import Flag, FlagDecorator, FlagGenerator
from aiogram.dispatcher.flags import Flag, FlagDecorator, FlagGenerator
@pytest.fixture(name="flag")

View file

@ -4,7 +4,7 @@ import pytest
from aiogram import F
from aiogram.dispatcher.event.handler import HandlerObject
from aiogram.dispatcher.flags.getter import (
from aiogram.dispatcher.flags import (
check_flags,
extract_flags,
extract_flags_from_object,
@ -60,5 +60,5 @@ class TestGetters:
],
)
def test_check_flag(self, flags, magic, result):
with patch("aiogram.dispatcher.flags.getter.extract_flags", return_value=flags):
with patch("aiogram.dispatcher.flags.extract_flags", return_value=flags):
assert check_flags(object(), magic) == result

View file

@ -1,6 +1,6 @@
import pytest
from aiogram.dispatcher.fsm.storage.base import BaseEventIsolation, StorageKey
from aiogram.fsm.storage.base import BaseEventIsolation, StorageKey
from tests.mocked_bot import MockedBot
pytestmark = pytest.mark.asyncio

View file

@ -1,11 +1,7 @@
import pytest
from aiogram.dispatcher.fsm.storage.base import DEFAULT_DESTINY, StorageKey
from aiogram.dispatcher.fsm.storage.redis import (
DefaultKeyBuilder,
RedisEventIsolation,
RedisStorage,
)
from aiogram.fsm.storage.base import DEFAULT_DESTINY, StorageKey
from aiogram.fsm.storage.redis import DefaultKeyBuilder, RedisEventIsolation, RedisStorage
pytestmark = pytest.mark.asyncio

View file

@ -1,6 +1,6 @@
import pytest
from aiogram.dispatcher.fsm.storage.base import BaseStorage, StorageKey
from aiogram.fsm.storage.base import BaseStorage, StorageKey
from tests.mocked_bot import MockedBot
pytestmark = pytest.mark.asyncio

View file

@ -1,8 +1,8 @@
import pytest
from aiogram.dispatcher.fsm.context import FSMContext
from aiogram.dispatcher.fsm.storage.base import StorageKey
from aiogram.dispatcher.fsm.storage.memory import MemoryStorage
from aiogram.fsm.context import FSMContext
from aiogram.fsm.storage.base import StorageKey
from aiogram.fsm.storage.memory import MemoryStorage
from tests.mocked_bot import MockedBot
pytestmark = pytest.mark.asyncio

View file

@ -1,6 +1,6 @@
import pytest
from aiogram.dispatcher.fsm.state import State, StatesGroup, any_state
from aiogram.fsm.state import State, StatesGroup, any_state
class TestState:

View file

@ -1,6 +1,6 @@
import pytest
from aiogram.dispatcher.fsm.strategy import FSMStrategy, apply_strategy
from aiogram.fsm.strategy import FSMStrategy, apply_strategy
class TestStrategy:

View file

@ -7,7 +7,7 @@ import pytest
from aiogram import Bot
from aiogram.dispatcher.event.handler import HandlerObject
from aiogram.dispatcher.handler.base import BaseHandler
from aiogram.handlers import BaseHandler
from aiogram.types import Chat, Message, Update
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler import CallbackQueryHandler
from aiogram.handlers import CallbackQueryHandler
from aiogram.types import CallbackQuery, User
pytestmark = pytest.mark.asyncio

View file

@ -3,7 +3,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler.chat_member import ChatMemberHandler
from aiogram.handlers import ChatMemberHandler
from aiogram.types import Chat, ChatMemberMember, ChatMemberUpdated, User
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler import ChosenInlineResultHandler
from aiogram.handlers import ChosenInlineResultHandler
from aiogram.types import ChosenInlineResult, User
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler import ErrorHandler
from aiogram.handlers import ErrorHandler
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler import InlineQueryHandler
from aiogram.handlers import InlineQueryHandler
from aiogram.types import InlineQuery, User
pytestmark = pytest.mark.asyncio

View file

@ -3,8 +3,8 @@ from typing import Any
import pytest
from aiogram.dispatcher.filters import CommandObject
from aiogram.dispatcher.handler.message import MessageHandler, MessageHandlerCommandMixin
from aiogram.filters import CommandObject
from aiogram.handlers import MessageHandler, MessageHandlerCommandMixin
from aiogram.types import Chat, Message, User
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler import PollHandler
from aiogram.handlers import PollHandler
from aiogram.types import Poll, PollOption
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler import PreCheckoutQueryHandler
from aiogram.handlers import PreCheckoutQueryHandler
from aiogram.types import PreCheckoutQuery, User
pytestmark = pytest.mark.asyncio

View file

@ -2,7 +2,7 @@ from typing import Any
import pytest
from aiogram.dispatcher.handler import ShippingQueryHandler
from aiogram.handlers import ShippingQueryHandler
from aiogram.types import ShippingAddress, ShippingQuery, User
pytestmark = pytest.mark.asyncio

View file

@ -3,9 +3,9 @@ from typing import Any, Dict
import pytest
from aiogram import Dispatcher
from aiogram.dispatcher.fsm.context import FSMContext
from aiogram.dispatcher.fsm.storage.base import StorageKey
from aiogram.dispatcher.fsm.storage.memory import MemoryStorage
from aiogram.fsm.context import FSMContext
from aiogram.fsm.storage.base import StorageKey
from aiogram.fsm.storage.memory import MemoryStorage
from aiogram.types import Update, User
from aiogram.utils.i18n import ConstI18nMiddleware, FSMI18nMiddleware, I18n, SimpleI18nMiddleware
from aiogram.utils.i18n.context import get_i18n, gettext, lazy_gettext

View file

@ -1,6 +1,6 @@
import pytest
from aiogram.dispatcher.filters.callback_data import CallbackData
from aiogram.filters.callback_data import CallbackData
from aiogram.types import (
InlineKeyboardButton,
InlineKeyboardMarkup,

View file

@ -10,15 +10,15 @@ from aiohttp.test_utils import TestClient
from aiohttp.web_app import Application
from aiogram import Dispatcher, F
from aiogram.dispatcher.webhook.aiohttp_server import (
from aiogram.methods import GetMe, Request
from aiogram.types import Message, User
from aiogram.webhook.aiohttp_server import (
SimpleRequestHandler,
TokenBasedRequestHandler,
ip_filter_middleware,
setup_application,
)
from aiogram.dispatcher.webhook.security import IPFilter
from aiogram.methods import GetMe, Request
from aiogram.types import Message, User
from aiogram.webhook.security import IPFilter
from tests.mocked_bot import MockedBot
try:

View file

@ -2,7 +2,7 @@ from ipaddress import IPv4Address, IPv4Network
import pytest
from aiogram.dispatcher.webhook.security import IPFilter
from aiogram.webhook.security import IPFilter
class TestSecurity: