mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Refactor aiogram client and update tests
Refactored base.py to improve code readability by separating response_type operation from model_validate(). Also, adjusted the parameters in URLInputFile() within test_input_file.py for better test coverage. Updated input_file.py to streamline read method and avoid unnecessary instantiation of Bot class. Lastly, adjusted typing in methods/base.py to enhance code clarity.
This commit is contained in:
parent
7c314754a7
commit
a9d8b7bd3d
4 changed files with 30 additions and 24 deletions
|
|
@ -4,6 +4,7 @@ from aresponses import ResponsesMockServer
|
|||
|
||||
from aiogram import Bot
|
||||
from aiogram.types import BufferedInputFile, FSInputFile, InputFile, URLInputFile
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestInputFile:
|
||||
|
|
@ -72,10 +73,8 @@ class TestInputFile:
|
|||
aresponses.add(
|
||||
aresponses.ANY, aresponses.ANY, "get", aresponses.Response(status=200, body=b"\f" * 10)
|
||||
)
|
||||
|
||||
Bot.set_current(Bot("42:TEST"))
|
||||
|
||||
file = URLInputFile("https://test.org/", chunk_size=1)
|
||||
bot = Bot(token="42:TEST")
|
||||
file = URLInputFile("https://test.org/", bot, chunk_size=1)
|
||||
|
||||
size = 0
|
||||
async for chunk in file:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue