mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
29 lines
697 B
Python
29 lines
697 B
Python
from typing import Any
|
|
|
|
import pytest
|
|
|
|
from aiogram.api.types import (
|
|
CallbackQuery,
|
|
InlineQuery,
|
|
Poll,
|
|
PollOption,
|
|
ShippingAddress,
|
|
ShippingQuery,
|
|
User,
|
|
)
|
|
from aiogram.dispatcher.handler import ErrorHandler, PollHandler
|
|
|
|
|
|
class TestErrorHandler:
|
|
@pytest.mark.asyncio
|
|
async def test_extensions(self):
|
|
event = KeyError("kaboom")
|
|
|
|
class MyHandler(ErrorHandler):
|
|
async def handle(self) -> Any:
|
|
assert self.event == event
|
|
assert self.exception_name == event.__class__.__name__
|
|
assert self.exception_message == str(event)
|
|
return True
|
|
|
|
assert await MyHandler(event)
|