mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Remove filters factory, introduce docs translation (#978)
* Rewrite filters * Update README.rst * Fixed tests * Small optimization of the Text filter (TY to @bomzheg) * Remove dataclass slots argument in due to the only Python 3.10 has an slots argument * Fixed mypy * Update tests * Disable Python 3.11 * Fixed #1013: Empty mention should be None instead of empty string. * Added #990 to the changelog * Added #942 to the changelog * Fixed coverage * Update poetry and dependencies * Fixed mypy * Remove deprecated code * Added more tests, update pyproject.toml * Partial update docs * Added initial Docs translation files * Added more changes * Added log message when connection is established in polling process * Fixed action * Disable lint for PyPy * Added changelog for docs translation
This commit is contained in:
parent
94030903ec
commit
f4251382e8
610 changed files with 61738 additions and 1687 deletions
|
|
@ -30,6 +30,7 @@ from aiogram.types import (
|
|||
Update,
|
||||
User,
|
||||
)
|
||||
from aiogram.types.error_event import ErrorEvent
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
try:
|
||||
|
|
@ -76,6 +77,12 @@ class TestDispatcher:
|
|||
assert dp.update.handlers[0].callback == dp._listen_update
|
||||
assert dp.update.outer_middleware
|
||||
|
||||
def test_init_args(self, bot: MockedBot):
|
||||
with pytest.raises(TypeError):
|
||||
Dispatcher(bot)
|
||||
with pytest.raises(TypeError):
|
||||
Dispatcher(storage=bot)
|
||||
|
||||
def test_data_bind(self):
|
||||
dp = Dispatcher()
|
||||
assert dp.get("foo") is None
|
||||
|
|
@ -650,15 +657,15 @@ class TestDispatcher:
|
|||
await dp.feed_update(bot, update)
|
||||
|
||||
@router.errors()
|
||||
async def error_handler(event: Update, exception: Exception):
|
||||
async def error_handler(event: ErrorEvent):
|
||||
return "KABOOM"
|
||||
|
||||
response = await dp.feed_update(bot, update)
|
||||
assert response == "KABOOM"
|
||||
|
||||
@dp.errors()
|
||||
async def root_error_handler(event: Update, exception: Exception):
|
||||
return exception
|
||||
async def root_error_handler(event: ErrorEvent):
|
||||
return event.exception
|
||||
|
||||
response = await dp.feed_update(bot, update)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue