test: consolidate repetitive cases across the suite

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-25 14:28:21 +08:00
1 parent c406024b59
commit 6eccc2859a
31 files changed
+745 -1315

No files matched your search

+21 -35
View File
@@ -4,6 +4,8 @@ from __future__ import annotations
from unittest.mock import patch
import pytest
from nanobot.config.schema import ProvidersConfig
from nanobot.providers.openai_compat_provider import OpenAICompatProvider
from nanobot.providers.registry import PROVIDERS, find_by_name
@@ -54,37 +56,35 @@ def test_mistral_keyword_match_covers_model_families() -> None:
assert config.get_provider_name(model) == "mistral", model
def test_reasoning_effort_low_remaps_to_none_omitted() -> None:
"""Mistral rejects low/medium efforts: low should map to "none" (omitted)."""
@pytest.mark.parametrize(
"model, effort",
[
pytest.param("mistral-medium-3-5", "low", id="low_remaps_to_none_omitted"),
pytest.param("mistral-vibe-cli-latest", "minimal", id="minimal_remaps_to_none_omitted"),
],
)
def test_mistral_omits_low_reasoning_effort(model, effort) -> None:
p = _mistral_provider()
kwargs = p._build_kwargs(
messages=[{"role": "user", "content": "hi"}],
tools=None,
model="mistral-medium-3-5",
model=model,
max_tokens=64,
temperature=0.5,
reasoning_effort="low",
reasoning_effort=effort,
tool_choice=None,
)
assert "reasoning_effort" not in kwargs
def test_reasoning_effort_minimal_remaps_to_none_omitted() -> None:
p = _mistral_provider()
kwargs = p._build_kwargs(
messages=[{"role": "user", "content": "hi"}],
tools=None,
model="mistral-vibe-cli-latest",
max_tokens=64,
temperature=0.5,
reasoning_effort="minimal",
tool_choice=None,
)
assert "reasoning_effort" not in kwargs
def test_reasoning_effort_medium_remaps_to_high() -> None:
"""Mistral has no 'medium' tier: bump up to 'high'."""
@pytest.mark.parametrize(
"effort",
[
pytest.param("medium", id="medium_remaps_to_high"),
pytest.param("high", id="high_passes_through"),
],
)
def test_mistral_uses_high_reasoning_effort(effort) -> None:
p = _mistral_provider()
kwargs = p._build_kwargs(
messages=[{"role": "user", "content": "hi"}],
@@ -92,21 +92,7 @@ def test_reasoning_effort_medium_remaps_to_high() -> None:
model="mistral-medium-3-5",
max_tokens=64,
temperature=0.5,
reasoning_effort="medium",
tool_choice=None,
)
assert kwargs["reasoning_effort"] == "high"
def test_reasoning_effort_high_passes_through() -> None:
p = _mistral_provider()
kwargs = p._build_kwargs(
messages=[{"role": "user", "content": "hi"}],
tools=None,
model="mistral-medium-3-5",
max_tokens=64,
temperature=0.5,
reasoning_effort="high",
reasoning_effort=effort,
tool_choice=None,
)
assert kwargs["reasoning_effort"] == "high"