aiogram/tests/test_dispatcher/test_handler/test_error.py
Alex Root Junior 83d6ab48c5
Backport and improvements (#601)
* Backport RedisStorage, deep-linking
* Allow prereleases for aioredis
* Bump dependencies
* Correctly skip Redis tests on Windows
* Reformat tests code and bump Makefile
2021-06-15 01:45:31 +03:00

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)