From b806bd01901bc8c24567c2127ca88d625ef646da Mon Sep 17 00:00:00 2001 From: JRoot Junior Date: Fri, 10 Nov 2023 00:12:02 +0200 Subject: [PATCH] Small fix in tests --- .../test_dispatcher/test_event/test_event.py | 2 +- .../test_event/test_handler.py | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/test_dispatcher/test_event/test_event.py b/tests/test_dispatcher/test_event/test_event.py index 3b35579c..91c5fbec 100644 --- a/tests/test_dispatcher/test_event/test_event.py +++ b/tests/test_dispatcher/test_event/test_event.py @@ -46,7 +46,7 @@ class TestEventObserver: assert observer.handlers[2].awaitable with patch( - "aiogram.dispatcher.event.handler.CallableMixin.call", + "aiogram.dispatcher.event.handler.CallableObject.call", new_callable=AsyncMock, ) as mocked_my_handler: results = await observer.trigger("test") diff --git a/tests/test_dispatcher/test_event/test_handler.py b/tests/test_dispatcher/test_event/test_handler.py index f7000d8e..2e35c189 100644 --- a/tests/test_dispatcher/test_event/test_handler.py +++ b/tests/test_dispatcher/test_event/test_handler.py @@ -5,7 +5,7 @@ import pytest from magic_filter import F as A from aiogram import F -from aiogram.dispatcher.event.handler import CallableMixin, FilterObject, HandlerObject +from aiogram.dispatcher.event.handler import CallableObject, FilterObject, HandlerObject from aiogram.filters import Filter from aiogram.handlers import BaseHandler from aiogram.types import Update @@ -38,16 +38,16 @@ class SyncCallable: return locals() -class TestCallableMixin: +class TestCallableObject: @pytest.mark.parametrize("callback", [callback2, TestFilter()]) def test_init_awaitable(self, callback): - obj = CallableMixin(callback) + obj = CallableObject(callback) assert obj.awaitable assert obj.callback == callback @pytest.mark.parametrize("callback", [callback1, SyncCallable()]) def test_init_not_awaitable(self, callback): - obj = CallableMixin(callback) + obj = CallableObject(callback) assert not obj.awaitable assert obj.callback == callback @@ -62,7 +62,7 @@ class TestCallableMixin: ], ) def test_init_args_spec(self, callback, args): - obj = CallableMixin(callback) + obj = CallableObject(callback) assert set(obj.spec.args) == args def test_init_decorated(self): @@ -82,8 +82,8 @@ class TestCallableMixin: def callback2(foo, bar, baz): pass - obj1 = CallableMixin(callback1) - obj2 = CallableMixin(callback2) + obj1 = CallableObject(callback1) + obj2 = CallableObject(callback2) assert set(obj1.spec.args) == {"foo", "bar", "baz"} assert obj1.callback == callback1 @@ -125,17 +125,17 @@ class TestCallableMixin: ], ) def test_prepare_kwargs(self, callback, kwargs, result): - obj = CallableMixin(callback) + obj = CallableObject(callback) assert obj._prepare_kwargs(kwargs) == result async def test_sync_call(self): - obj = CallableMixin(callback1) + obj = CallableObject(callback1) result = await obj.call(foo=42, bar="test", baz="fuz", spam=True) assert result == {"foo": 42, "bar": "test", "baz": "fuz"} async def test_async_call(self): - obj = CallableMixin(callback2) + obj = CallableObject(callback2) result = await obj.call(foo=42, bar="test", baz="fuz", spam=True) assert result == {"foo": 42, "bar": "test", "baz": "fuz"}