Files
wehub-resource-sync 5296d0e97c
CI / Ban suppressions and legacy annotations (push) Has been cancelled
CI / pytest (push) Has been cancelled
CI / ruff-check (push) Has been cancelled
CI / ruff-format (push) Has been cancelled
CI / ty (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:44 +08:00

41 lines
1.2 KiB
Python

"""Tests for the OpenCode OpenAI-compatible provider."""
from free_claude_code.core.anthropic.models import MessagesRequest
from free_claude_code.providers.base import ProviderConfig
from tests.providers.support import passthrough_rate_limiter, profiled_provider
def test_build_request_body_preserves_empty_reasoning_content() -> None:
provider = profiled_provider(
"opencode",
ProviderConfig(
api_key="test_opencode_key",
base_url="https://example.invalid/v1",
rate_limit=1,
rate_window=1,
enable_thinking=True,
),
rate_limiter=passthrough_rate_limiter(),
)
request = MessagesRequest.model_validate(
{
"model": "m",
"messages": [
{
"role": "assistant",
"content": "visible",
"reasoning_content": "",
}
],
"thinking": {"type": "enabled"},
}
)
body = provider._build_request_body(request)
assert body["messages"][0] == {
"role": "assistant",
"content": "visible",
"reasoning_content": "",
}