black and ruff
Tests / test_and_lint (push) Successful in 12s

This commit is contained in:
2026-10-02 10:13:59 +02:00
parent ae7e1684e4
commit d5a7728f8b
4 changed files with 20 additions and 14 deletions
+1 -2
View File
@@ -1,9 +1,8 @@
import json
import re
from openai import OpenAI
import openai
from openai.types.chat import ChatCompletion
from openai import OpenAI
from photools3.models import (
LlmMessageContent,
+3
View File
@@ -1,12 +1,15 @@
import pytest
from photools3.llm_session import LlmSession
from photools3.photo import Photo
from test.test_photo import PATHS_DNG_EXAMPLES
@pytest.fixture
def test_photo():
return Photo(PATHS_DNG_EXAMPLES[0])
@pytest.fixture
def llm_session():
return LlmSession(
+6 -3
View File
@@ -1,8 +1,11 @@
import pytest
from photools3.llm_session import LlmSession
from photools3.photo import Photo
@pytest.mark.skipif(not LlmSession(system_prompt="").is_api_reachable(), reason="API not available")
from photools3.llm_session import LlmSession
@pytest.mark.skipif(
not LlmSession(system_prompt="").is_api_reachable(), reason="API not available"
)
def test_llm_session(llm_session, test_photo):
result = llm_session.call(
prompt="keywords for the attached picture", photos=[test_photo]
+5 -4
View File
@@ -1,8 +1,7 @@
import pytest
from unittest.mock import MagicMock, patch
from photools3.llm_session import LlmSession
from photools3.photo import Photo
from test.test_photo import PATHS_DNG_EXAMPLES
def test_llm_session_mocked(test_photo):
# We want to mock OpenAI client's chat.completions.create
@@ -22,7 +21,9 @@ def test_llm_session_mocked(test_photo):
mock_choice = MagicMock()
mock_message = MagicMock()
mock_message.content = '{"caption": "A beautiful sunset", "tags": ["sunset", "nature"]}'
mock_message.content = (
'{"caption": "A beautiful sunset", "tags": ["sunset", "nature"]}'
)
mock_choice.message = mock_message
mock_response.choices = [mock_choice]