test(aiand): derive retired models from the rows instead of pinning dates

The wildcard test now reads each row's deprecation_date, so it holds whichever dates ai& sets, and the test that only restated the JSON dates is gone
This commit is contained in:
Islomjon (Toji) 2026-10-30 14:33:06 +09:00
parent 629d819d23
commit 1a6ce18e57

View file

@ -90,32 +90,19 @@ def _aiand_catalog() -> frozenset[str]:
return frozenset(name for name, info in litellm.model_cost.items() if info.get("litellm_provider") == "aiand")
AIAND_RETIREMENT_DATES: Final = {
"aiand/deepseek-ai/deepseek-v4-flash": "2026-10-27",
"aiand/zai-org/glm-5.2": "2026-10-27",
"aiand/moonshotai/kimi-k2.7-code": "2026-10-27",
"aiand/deepseek-ai/deepseek-v4.1-flash": "2026-11-06",
}
def test_aiand_wildcard_lists_only_its_live_models():
def test_aiand_wildcard_lists_only_models_not_yet_retired():
catalog: Final = _aiand_catalog()
retired: Final = frozenset(
model
for model, retired_on in AIAND_RETIREMENT_DATES.items()
if datetime.date.fromisoformat(retired_on) <= datetime.date.today()
name
for name in catalog
if (retired_on := litellm.model_cost[name].get("deprecation_date")) is not None
and datetime.date.fromisoformat(retired_on) <= datetime.date.today()
)
assert frozenset(AIAND_RETIREMENT_DATES) < catalog
assert catalog - retired
assert frozenset(get_known_models_from_wildcard("aiand/*")) == catalog - retired
def test_aiand_retired_models_carry_their_retirement_date():
for model, retired_on in AIAND_RETIREMENT_DATES.items():
assert litellm.model_cost[model]["deprecation_date"] == retired_on
def test_aiand_calls_are_billed_from_their_cost_rows():
catalog: Final = _aiand_catalog()
assert catalog