mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
HandlerObject: Unwrap handler before awaitable check (#435)
* Unwrap handler before awaitable check * Remove unused 'type:ignore' comment * Add wrapped handler tests
This commit is contained in:
parent
6f53f15577
commit
7ba153c7b1
2 changed files with 10 additions and 1 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import asyncio
|
||||
import datetime
|
||||
from functools import wraps
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from aiogram import Bot
|
||||
from aiogram.api.types import Chat, Message, Update
|
||||
from aiogram.dispatcher.event.handler import HandlerObject
|
||||
from aiogram.dispatcher.handler.base import BaseHandler
|
||||
|
||||
|
||||
|
|
@ -56,3 +58,9 @@ 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)
|
||||
assert HandlerObject(handler).awaitable is True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue