mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
refactor(ocr): keep contract test in provider suite
This commit is contained in:
parent
dc1c808edc
commit
44fc0e2455
1 changed files with 5 additions and 3 deletions
|
|
@ -6,7 +6,9 @@ from tests.transform_contracts.loader import load_contract_cases
|
|||
from tests.transform_contracts.registry import run_contract_case
|
||||
from tests.transform_contracts.schema import JsonValue, TransformationCase, expected_output
|
||||
|
||||
_CONTRACT_CASES: Final = load_contract_cases()
|
||||
_MISTRAL_OCR_CASES: Final = tuple(case for case in load_contract_cases() if case.operation.startswith("mistral.ocr."))
|
||||
if not _MISTRAL_OCR_CASES:
|
||||
raise ValueError("no Mistral OCR transformation contract cases found")
|
||||
|
||||
|
||||
class _ContractCaseRequest(Protocol):
|
||||
|
|
@ -14,13 +16,13 @@ class _ContractCaseRequest(Protocol):
|
|||
def param(self) -> TransformationCase: ...
|
||||
|
||||
|
||||
@pytest.fixture(params=_CONTRACT_CASES, ids=tuple(case.id for case in _CONTRACT_CASES))
|
||||
@pytest.fixture(params=_MISTRAL_OCR_CASES, ids=tuple(case.id for case in _MISTRAL_OCR_CASES))
|
||||
def contract_case(request: _ContractCaseRequest, monkeypatch: pytest.MonkeyPatch) -> TransformationCase:
|
||||
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
|
||||
return request.param
|
||||
|
||||
|
||||
def test_transformation_contract(contract_case: TransformationCase) -> None:
|
||||
def test_mistral_ocr_transformation_contract(contract_case: TransformationCase) -> None:
|
||||
actual: Final[JsonValue] = run_contract_case(contract_case)
|
||||
expected: Final[JsonValue] = expected_output(contract_case)
|
||||
assert actual == expected
|
||||
Loading…
Add table
Reference in a new issue