open-swe/tests/models/test_anthropic_model.py
Adam Moussa ae1f883b4c
refactor: move tests into tests/<domain>/ layout
Applies the plan's C5 step: git mv every test per the domain-reorg
move-map (movemap-m50.txt) into tests/{agent,analyzer,auth,dashboard,
github,middleware,models,reviewer,sandbox,slack,tools,webhooks}/, plus
the 13 fork-only placements from the scoping report §2c (Atlassian
webhook tests -> tests/webhooks/, test_atlassian_connect.py and
test_auth_error_leak.py -> tests/auth/, jira/confluence util tests ->
tests/tools/, test_repo_binding_isolation.py -> tests/sandbox/,
bot-identity/autofix tests -> tests/github/).

Path-only move: the only content edits are parents[1] -> parents[2]
fixes in test_e2b_integration.py and test_daytona_integration.py,
required because their __file__-relative ROOT path gained one more
directory level in the move.

Monkeypatch retargets for these files were already completed in C4;
none remained outstanding here.
2026-07-17 14:42:45 -04:00

55 lines
2.3 KiB
Python

import pytest
from agent.dashboard.options import SUPPORTED_MODELS, provider_fallback_pair
from agent.utils.model import provider_model_kwargs
SONNET_5_ID = "bedrock_converse:us.anthropic.claude-sonnet-5"
FABLE_5_ID = "bedrock_converse:us.anthropic.claude-fable-5"
def test_sonnet_5_is_supported_with_documented_efforts() -> None:
sonnet = next(m for m in SUPPORTED_MODELS if m["id"] == SONNET_5_ID)
assert sonnet["label"] == "Sonnet 5 (Bedrock)"
assert sonnet["efforts"] == ["low", "medium", "high", "xhigh", "max"]
assert sonnet["default_effort"] == "high"
assert sonnet["supports_images"] is True
@pytest.mark.parametrize("effort", ["low", "medium", "high", "xhigh", "max"])
def test_sonnet_5_efforts_map_to_bedrock_kwargs(effort: str) -> None:
kwargs = provider_model_kwargs(SONNET_5_ID, effort, max_tokens=16_000)
assert kwargs["max_tokens"] == 16_000
fields = kwargs["additional_model_request_fields"]
assert fields["output_config"] == {"effort": effort}
assert fields["thinking"] == {"type": "adaptive", "display": "summarized"}
def test_sonnet_46_fallback_uses_sonnet_5() -> None:
assert provider_fallback_pair("bedrock_converse:us.anthropic.claude-sonnet-4-6", "xhigh") == (
SONNET_5_ID,
"xhigh",
)
def test_opus_fallback_stays_on_opus_family() -> None:
assert provider_fallback_pair("bedrock_converse:us.anthropic.claude-opus-4-7", "xhigh") == (
"bedrock_converse:us.anthropic.claude-opus-4-8",
"xhigh",
)
def test_fable_5_is_supported_with_documented_efforts() -> None:
fable = next(m for m in SUPPORTED_MODELS if m["id"] == FABLE_5_ID)
assert fable["label"] == "Fable 5"
assert fable["efforts"] == ["low", "medium", "high", "xhigh", "max"]
assert fable["default_effort"] == "high"
assert fable["supports_images"] is True
@pytest.mark.parametrize("effort", ["low", "medium", "high", "xhigh", "max"])
def test_fable_5_efforts_map_to_bedrock_kwargs(effort: str) -> None:
kwargs = provider_model_kwargs(FABLE_5_ID, effort, max_tokens=16_000)
assert kwargs["max_tokens"] == 16_000
fields = kwargs["additional_model_request_fields"]
assert fields["output_config"] == {"effort": effort}
assert fields["thinking"] == {"type": "adaptive", "display": "summarized"}