diff --git a/aiogram/types/input_file.py b/aiogram/types/input_file.py index 99e48c50..c4090505 100644 --- a/aiogram/types/input_file.py +++ b/aiogram/types/input_file.py @@ -135,7 +135,10 @@ class URLInputFile(InputFile): bot = Bot.get_current(no_error=False) stream = bot.session.stream_content( - url=self.url, timeout=self.timeout, chunk_size=self.chunk_size, raise_for_status=True, + url=self.url, + timeout=self.timeout, + chunk_size=self.chunk_size, + raise_for_status=True, ) async for chunk in stream: diff --git a/tests/mocked_bot.py b/tests/mocked_bot.py index 4dbadfac..25a9b38e 100644 --- a/tests/mocked_bot.py +++ b/tests/mocked_bot.py @@ -37,7 +37,11 @@ class MockedSession(BaseSession): return response.result # type: ignore async def stream_content( - self, url: str, timeout: int, chunk_size: int, raise_for_status: bool, + self, + url: str, + timeout: int, + chunk_size: int, + raise_for_status: bool, ) -> AsyncGenerator[bytes, None]: # pragma: no cover yield b"" diff --git a/tests/test_api/test_client/test_session/test_aiohttp_session.py b/tests/test_api/test_client/test_session/test_aiohttp_session.py index d9a11a77..62b015ee 100644 --- a/tests/test_api/test_client/test_session/test_aiohttp_session.py +++ b/tests/test_api/test_client/test_session/test_aiohttp_session.py @@ -209,10 +209,13 @@ class TestAiohttpSession: async def test_stream_content_404(self, aresponses: ResponsesMockServer): aresponses.add( - aresponses.ANY, aresponses.ANY, "get", aresponses.Response( + aresponses.ANY, + aresponses.ANY, + "get", + aresponses.Response( status=404, body=b"File not found", - ) + ), ) session = AiohttpSession() stream = session.stream_content(