Update deprecated Python 3.8 typing (#13971)
This commit is contained in:
@@ -4,7 +4,7 @@ import base64
|
||||
import mimetypes
|
||||
import os
|
||||
from tempfile import NamedTemporaryFile, TemporaryDirectory
|
||||
from typing import TYPE_CHECKING, Dict, NamedTuple, Optional, Tuple
|
||||
from typing import TYPE_CHECKING, NamedTuple, Optional
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
@@ -30,7 +30,7 @@ TEST_IMAGE_URLS = [
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def url_images() -> Dict[str, Image.Image]:
|
||||
def url_images() -> dict[str, Image.Image]:
|
||||
connector = MediaConnector()
|
||||
|
||||
return {
|
||||
@@ -39,7 +39,7 @@ def url_images() -> Dict[str, Image.Image]:
|
||||
}
|
||||
|
||||
|
||||
def get_supported_suffixes() -> Tuple[str, ...]:
|
||||
def get_supported_suffixes() -> tuple[str, ...]:
|
||||
# We should at least test the file types mentioned in GPT-4 with Vision
|
||||
OPENAI_SUPPORTED_SUFFIXES = ('.png', '.jpeg', '.jpg', '.webp', '.gif')
|
||||
|
||||
@@ -66,7 +66,7 @@ async def test_fetch_image_http(image_url: str):
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("image_url", TEST_IMAGE_URLS)
|
||||
@pytest.mark.parametrize("suffix", get_supported_suffixes())
|
||||
async def test_fetch_image_base64(url_images: Dict[str, Image.Image],
|
||||
async def test_fetch_image_base64(url_images: dict[str, Image.Image],
|
||||
image_url: str, suffix: str):
|
||||
connector = MediaConnector()
|
||||
url_image = url_images[image_url]
|
||||
|
||||
Reference in New Issue
Block a user