Fedir Zadniprovskyi 2024-10-01
chore: auto-fix ruff errors
@36fcca48076d8984e2c1418d282fb406175fb61e
tests/api_model_test.py
--- tests/api_model_test.py
+++ tests/api_model_test.py
@@ -7,19 +7,19 @@
 MIN_EXPECTED_NUMBER_OF_MODELS = 70  # At the time of the test creation there are 89 models
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 async def test_list_models(openai_client: AsyncOpenAI) -> None:
     models = (await openai_client.models.list()).data
     assert len(models) > MIN_EXPECTED_NUMBER_OF_MODELS
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 async def test_model_exists(openai_client: AsyncOpenAI) -> None:
     model = await openai_client.models.retrieve(MODEL_THAT_EXISTS)
     assert model.id == MODEL_THAT_EXISTS
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 async def test_model_does_not_exist(openai_client: AsyncOpenAI) -> None:
     with pytest.raises(openai.NotFoundError):
         await openai_client.models.retrieve(MODEL_THAT_DOES_NOT_EXIST)
tests/api_timestamp_granularities_test.py
--- tests/api_timestamp_granularities_test.py
+++ tests/api_timestamp_granularities_test.py
@@ -2,12 +2,13 @@
 
 from pathlib import Path
 
-from faster_whisper_server.api_models import TIMESTAMP_GRANULARITIES_COMBINATIONS, TimestampGranularities
 from openai import AsyncOpenAI
 import pytest
 
+from faster_whisper_server.api_models import TIMESTAMP_GRANULARITIES_COMBINATIONS, TimestampGranularities
 
-@pytest.mark.asyncio()
+
+@pytest.mark.asyncio
 @pytest.mark.parametrize("timestamp_granularities", TIMESTAMP_GRANULARITIES_COMBINATIONS)
 async def test_api_json_response_format_and_timestamp_granularities_combinations(
     openai_client: AsyncOpenAI,
@@ -20,7 +21,7 @@
     )
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 @pytest.mark.parametrize("timestamp_granularities", TIMESTAMP_GRANULARITIES_COMBINATIONS)
 async def test_api_verbose_json_response_format_and_timestamp_granularities_combinations(
     openai_client: AsyncOpenAI,
tests/conftest.py
--- tests/conftest.py
+++ tests/conftest.py
@@ -3,11 +3,12 @@
 import os
 
 from fastapi.testclient import TestClient
-from faster_whisper_server.main import create_app
 from httpx import ASGITransport, AsyncClient
 from openai import AsyncOpenAI
 import pytest
 import pytest_asyncio
+
+from faster_whisper_server.main import create_app
 
 disable_loggers = ["multipart.multipart", "faster_whisper"]
 
@@ -19,7 +20,7 @@
 
 
 # NOTE: not being used. Keeping just in case
-@pytest.fixture()
+@pytest.fixture
 def client() -> Generator[TestClient, None, None]:
     os.environ["WHISPER__MODEL"] = "Systran/faster-whisper-tiny.en"
     with TestClient(create_app()) as client:
@@ -38,7 +39,7 @@
     return AsyncOpenAI(api_key="cant-be-empty", http_client=aclient)
 
 
-@pytest.fixture()
+@pytest.fixture
 def actual_openai_client() -> AsyncOpenAI:
     return AsyncOpenAI(
         base_url="https://api.openai.com/v1"
tests/openai_timestamp_granularities_test.py
--- tests/openai_timestamp_granularities_test.py
+++ tests/openai_timestamp_granularities_test.py
@@ -2,13 +2,14 @@
 
 from pathlib import Path
 
-from faster_whisper_server.api_models import TIMESTAMP_GRANULARITIES_COMBINATIONS, TimestampGranularities
 from openai import AsyncOpenAI, BadRequestError
 import pytest
 
+from faster_whisper_server.api_models import TIMESTAMP_GRANULARITIES_COMBINATIONS, TimestampGranularities
 
-@pytest.mark.asyncio()
-@pytest.mark.requires_openai()
+
+@pytest.mark.asyncio
+@pytest.mark.requires_openai
 @pytest.mark.parametrize("timestamp_granularities", TIMESTAMP_GRANULARITIES_COMBINATIONS)
 async def test_openai_json_response_format_and_timestamp_granularities_combinations(
     actual_openai_client: AsyncOpenAI,
@@ -29,8 +30,8 @@
         )
 
 
-@pytest.mark.asyncio()
-@pytest.mark.requires_openai()
+@pytest.mark.asyncio
+@pytest.mark.requires_openai
 @pytest.mark.parametrize("timestamp_granularities", TIMESTAMP_GRANULARITIES_COMBINATIONS)
 async def test_openai_verbose_json_response_format_and_timestamp_granularities_combinations(
     actual_openai_client: AsyncOpenAI,
tests/sse_test.py
--- tests/sse_test.py
+++ tests/sse_test.py
@@ -2,16 +2,17 @@
 from pathlib import Path
 
 import anyio
-from faster_whisper_server.api_models import (
-    CreateTranscriptionResponseJson,
-    CreateTranscriptionResponseVerboseJson,
-)
 from httpx import AsyncClient
 from httpx_sse import aconnect_sse
 import pytest
 import srt
 import webvtt
 import webvtt.vtt
+
+from faster_whisper_server.api_models import (
+    CreateTranscriptionResponseJson,
+    CreateTranscriptionResponseVerboseJson,
+)
 
 FILE_PATHS = ["audio.wav"]  # HACK
 ENDPOINTS = [
@@ -23,7 +24,7 @@
 parameters = [(file_path, endpoint) for endpoint in ENDPOINTS for file_path in FILE_PATHS]
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 @pytest.mark.parametrize(("file_path", "endpoint"), parameters)
 async def test_streaming_transcription_text(aclient: AsyncClient, file_path: str, endpoint: str) -> None:
     extension = Path(file_path).suffix[1:]
@@ -39,7 +40,7 @@
             assert len(event.data) > 1  # HACK: 1 because of the space character that's always prepended
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 @pytest.mark.parametrize(("file_path", "endpoint"), parameters)
 async def test_streaming_transcription_json(aclient: AsyncClient, file_path: str, endpoint: str) -> None:
     extension = Path(file_path).suffix[1:]
@@ -54,7 +55,7 @@
             CreateTranscriptionResponseJson(**json.loads(event.data))
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 @pytest.mark.parametrize(("file_path", "endpoint"), parameters)
 async def test_streaming_transcription_verbose_json(aclient: AsyncClient, file_path: str, endpoint: str) -> None:
     extension = Path(file_path).suffix[1:]
@@ -69,7 +70,7 @@
             CreateTranscriptionResponseVerboseJson(**json.loads(event.data))
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 async def test_transcription_vtt(aclient: AsyncClient) -> None:
     async with await anyio.open_file("audio.wav", "rb") as f:
         data = await f.read()
@@ -87,7 +88,7 @@
         webvtt.from_string(text)
 
 
-@pytest.mark.asyncio()
+@pytest.mark.asyncio
 async def test_transcription_srt(aclient: AsyncClient) -> None:
     async with await anyio.open_file("audio.wav", "rb") as f:
         data = await f.read()
Add a comment
List