mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
* Backport RedisStorage, deep-linking * Allow prereleases for aioredis * Bump dependencies * Correctly skip Redis tests on Windows * Reformat tests code and bump Makefile
20 lines
538 B
Python
20 lines
538 B
Python
from typing import Any
|
|
|
|
import pytest
|
|
|
|
from aiogram.dispatcher.handler import ErrorHandler
|
|
|
|
|
|
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)
|