mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
refactor: remove redundant pytest marks (#654)
This commit is contained in:
parent
fff33e4ac9
commit
f2f276b8cf
111 changed files with 221 additions and 256 deletions
|
|
@ -10,6 +10,8 @@ from aiogram.dispatcher.event.handler import HandlerObject
|
|||
from aiogram.dispatcher.handler.base import BaseHandler
|
||||
from aiogram.types import Chat, Message, Update
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class MyHandler(BaseHandler):
|
||||
async def handle(self) -> Any:
|
||||
|
|
@ -18,7 +20,6 @@ class MyHandler(BaseHandler):
|
|||
|
||||
|
||||
class TestBaseClassBasedHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_base_handler(self):
|
||||
event = Update(update_id=42)
|
||||
handler = MyHandler(event=event, key=42)
|
||||
|
|
@ -28,7 +29,6 @@ class TestBaseClassBasedHandler:
|
|||
assert not hasattr(handler, "filters")
|
||||
assert await handler == 42
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_from_context(self):
|
||||
event = Update(update_id=42)
|
||||
handler = MyHandler(event=event, key=42)
|
||||
|
|
@ -40,7 +40,6 @@ class TestBaseClassBasedHandler:
|
|||
Bot.set_current(bot)
|
||||
assert handler.bot == bot
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_from_data(self):
|
||||
event = Update(update_id=42)
|
||||
bot = Bot("42:TEST")
|
||||
|
|
@ -59,7 +58,6 @@ class TestBaseClassBasedHandler:
|
|||
assert handler.event == event
|
||||
assert handler.update == update
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_wrapped_handler(self):
|
||||
# wrap the handler on dummy function
|
||||
handler = wraps(MyHandler)(lambda: None)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import pytest
|
|||
from aiogram.dispatcher.handler import CallbackQueryHandler
|
||||
from aiogram.types import CallbackQuery, User
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestCallbackQueryHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_attributes_aliases(self):
|
||||
event = CallbackQuery(
|
||||
id="chosen",
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ import pytest
|
|||
from aiogram.dispatcher.handler.chat_member import ChatMemberHandler
|
||||
from aiogram.types import Chat, ChatMemberMember, ChatMemberUpdated, User
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestChatMemberUpdated:
|
||||
@pytest.mark.asyncio
|
||||
async def test_attributes_aliases(self):
|
||||
event = ChatMemberUpdated(
|
||||
chat=Chat(id=42, type="private"),
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import pytest
|
|||
from aiogram.dispatcher.handler import ChosenInlineResultHandler
|
||||
from aiogram.types import ChosenInlineResult, User
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestChosenInlineResultHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_attributes_aliases(self):
|
||||
event = ChosenInlineResult(
|
||||
result_id="chosen",
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ import pytest
|
|||
|
||||
from aiogram.dispatcher.handler import ErrorHandler
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestErrorHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_extensions(self):
|
||||
event = KeyError("kaboom")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import pytest
|
|||
from aiogram.dispatcher.handler import InlineQueryHandler
|
||||
from aiogram.types import InlineQuery, User
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestCallbackQueryHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_attributes_aliases(self):
|
||||
event = InlineQuery(
|
||||
id="query",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ from aiogram.dispatcher.filters import CommandObject
|
|||
from aiogram.dispatcher.handler.message import MessageHandler, MessageHandlerCommandMixin
|
||||
from aiogram.types import Chat, Message, User
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class MyHandler(MessageHandler):
|
||||
async def handle(self) -> Any:
|
||||
|
|
@ -14,7 +16,6 @@ class MyHandler(MessageHandler):
|
|||
|
||||
|
||||
class TestClassBasedMessageHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_message_handler(self):
|
||||
event = Message(
|
||||
message_id=42,
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import pytest
|
|||
from aiogram.dispatcher.handler import PollHandler
|
||||
from aiogram.types import Poll, PollOption
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestShippingQueryHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_attributes_aliases(self):
|
||||
event = Poll(
|
||||
id="query",
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import pytest
|
|||
from aiogram.dispatcher.handler import PreCheckoutQueryHandler
|
||||
from aiogram.types import PreCheckoutQuery, User
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestPreCheckoutQueryHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_attributes_aliases(self):
|
||||
event = PreCheckoutQuery(
|
||||
id="query",
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import pytest
|
|||
from aiogram.dispatcher.handler import ShippingQueryHandler
|
||||
from aiogram.types import ShippingAddress, ShippingQuery, User
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
class TestShippingQueryHandler:
|
||||
@pytest.mark.asyncio
|
||||
async def test_attributes_aliases(self):
|
||||
event = ShippingQuery(
|
||||
id="query",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue