mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 18:19:34 +00:00
Use AsyncMock with python 3.8 instead of asynctest
This commit is contained in:
parent
6f56f24296
commit
8e5cb067df
8 changed files with 123 additions and 105 deletions
|
|
@ -2,7 +2,6 @@ import datetime
|
|||
import time
|
||||
|
||||
import pytest
|
||||
from asynctest import CoroutineMock, patch
|
||||
|
||||
from aiogram import Bot
|
||||
from aiogram.api.methods import GetMe, GetUpdates, SendMessage
|
||||
|
|
@ -11,6 +10,11 @@ from aiogram.dispatcher.dispatcher import Dispatcher
|
|||
from aiogram.dispatcher.router import Router
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
try:
|
||||
from asynctest import CoroutineMock, patch
|
||||
except ImportError:
|
||||
from unittest.mock import AsyncMock as CoroutineMock, patch
|
||||
|
||||
|
||||
class TestDispatcher:
|
||||
def test_parent_router(self):
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
from typing import Awaitable
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from asynctest import CoroutineMock
|
||||
|
||||
from aiogram.dispatcher.filters.base import BaseFilter
|
||||
|
||||
try:
|
||||
from asynctest import CoroutineMock, patch
|
||||
except ImportError:
|
||||
from unittest.mock import AsyncMock as CoroutineMock, patch
|
||||
|
||||
|
||||
class MyFilter(BaseFilter):
|
||||
foo: str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue