mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-05 01:37:46 +08:00
Refa: convert download_img to async (#13477)
### What problem does this PR solve? Convert download_img to async. ### Type of change - [x] Refactoring - [x] Performance Improvement
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#
|
||||
import uuid
|
||||
import hashlib
|
||||
import pytest
|
||||
from common.misc_utils import get_uuid, download_img, hash_str2int, convert_bytes
|
||||
|
||||
|
||||
@ -91,14 +92,16 @@ class TestGetUuid:
|
||||
class TestDownloadImg:
|
||||
"""Test cases for download_img function"""
|
||||
|
||||
def test_empty_url_returns_empty_string(self):
|
||||
@pytest.mark.asyncio
|
||||
async def test_empty_url_returns_empty_string(self):
|
||||
"""Test that empty URL returns empty string"""
|
||||
result = download_img("")
|
||||
result = await download_img("")
|
||||
assert result == ""
|
||||
|
||||
def test_none_url_returns_empty_string(self):
|
||||
@pytest.mark.asyncio
|
||||
async def test_none_url_returns_empty_string(self):
|
||||
"""Test that None URL returns empty string"""
|
||||
result = download_img(None)
|
||||
result = await download_img(None)
|
||||
assert result == ""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user