Skip to content

Commit a983b09

Browse files
committed
style: reformat threshold assignment and test response body definitions for improved readability.
1 parent 08e8a35 commit a983b09

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/apcore_toolkit/ai_enhancer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def __init__(
5050
) -> None:
5151
self.endpoint = endpoint or os.environ.get("APCORE_AI_ENDPOINT", _DEFAULT_ENDPOINT)
5252
self.model = model or os.environ.get("APCORE_AI_MODEL", _DEFAULT_MODEL)
53-
self.threshold = threshold if threshold is not None else self._parse_float_env("APCORE_AI_THRESHOLD", _DEFAULT_THRESHOLD)
53+
self.threshold = (
54+
threshold if threshold is not None else self._parse_float_env("APCORE_AI_THRESHOLD", _DEFAULT_THRESHOLD)
55+
)
5456
self.timeout = timeout if timeout is not None else self._parse_int_env("APCORE_AI_TIMEOUT", _DEFAULT_TIMEOUT)
5557

5658
if not 0.0 <= self.threshold <= 1.0:

tests/test_ai_enhancer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,7 @@ def test_mixed_modules(
328328
class TestCallLLM:
329329
def test_successful_call(self, enhancer: AIEnhancer) -> None:
330330
"""_call_llm should return the content from a valid API response."""
331-
response_body = json.dumps(
332-
{"choices": [{"message": {"content": '{"description": "test"}'}}]}
333-
).encode("utf-8")
331+
response_body = json.dumps({"choices": [{"message": {"content": '{"description": "test"}'}}]}).encode("utf-8")
334332

335333
mock_resp = unittest.mock.MagicMock()
336334
mock_resp.read.return_value = response_body
@@ -371,9 +369,7 @@ def test_malformed_response_raises_value_error(self, enhancer: AIEnhancer) -> No
371369

372370
def test_request_payload_structure(self, enhancer: AIEnhancer) -> None:
373371
"""_call_llm should send correct payload and headers."""
374-
response_body = json.dumps(
375-
{"choices": [{"message": {"content": "ok"}}]}
376-
).encode("utf-8")
372+
response_body = json.dumps({"choices": [{"message": {"content": "ok"}}]}).encode("utf-8")
377373

378374
mock_resp = unittest.mock.MagicMock()
379375
mock_resp.read.return_value = response_body

0 commit comments

Comments
 (0)