The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(video-gen): keep the i2v-only guard real once every family is dual-modality
teknium101338e88ec3f
diff --git a/tests/plugins/video_gen/test_fal_plugin.py b/tests/plugins/video_gen/test_fal_plugin.pyindex dbfa63201e7..dfcf40440f7 100644--- a/tests/plugins/video_gen/test_fal_plugin.py+++ b/tests/plugins/video_gen/test_fal_plugin.py@@ -212,27 +212,22 @@ def test_gemini_omni_flash_v11_is_dual_modality():assert meta["image_endpoint"] == "google/gemini-omni-flash/v1.1/image-to-video"-def test_text_only_job_errors_cleanly_for_i2v_only_family():- """Catalog-shape guard: a family without a text endpoint must error- cleanly instead of submitting to a None endpoint (kept alive with a- synthetic family now that every cataloged family is dual-modality)."""- from plugins.video_gen.fal import _build_payload-- synthetic = {- "text_endpoint": None,- "image_endpoint": "example/i2v-only/image-to-video",- "durations": (3, 10),- "duration_int": True,- "seed": False,- }- # Payload building for the i2v path must still work.- p = _build_payload(- synthetic, prompt="x", image_url="https://i.png", duration=None,- aspect_ratio="16:9", resolution="720p", negative_prompt=None,- audio=None, seed=None,- )- assert p["image_url"] == "https://i.png"- assert not synthetic.get("text_endpoint")+def test_text_only_job_errors_cleanly_for_i2v_only_family(monkeypatch):+ """Catalog-shape guard: a family without a text endpoint must error cleanly+ instead of submitting to a None endpoint. Every cataloged family is now+ dual-modality, so the guard is exercised with a synthetic family."""+ from plugins.video_gen import fal as fal_plugin+ from plugins.video_gen.fal import FALVideoGenProvider, _family++ synthetic = _family("Synthetic i2v", "~1s", "cheap", "test", None, "example/i2v-only/image-to-video", durations=(3, 10), duration_int=True)+ monkeypatch.setattr(fal_plugin, "_fal_video_available", lambda: True)+ monkeypatch.setattr(fal_plugin, "_load_fal_client", lambda: object())+ monkeypatch.setattr(fal_plugin, "_resolve_family", lambda explicit: ("synthetic", synthetic))+ monkeypatch.setattr(fal_plugin, "_submit_fal_video_request", lambda *a, **k: pytest.fail("submitted to a None endpoint"))++ result = FALVideoGenProvider().generate("a dog running")+ assert result["success"] is False+ assert result["error_type"] == "modality_unsupported"def test_every_family_has_required_metadata():diff --git a/tests/tools/test_video_generation_tool_surface_matrix.py b/tests/tools/test_video_generation_tool_surface_matrix.pyindex 96f7e74f129..f5870a77bff 100644--- a/tests/tools/test_video_generation_tool_surface_matrix.py+++ b/tests/tools/test_video_generation_tool_surface_matrix.py@@ -143,12 +143,6 @@ def _t2v_fal_families():return [fid for fid, meta in FAL_FAMILIES.items() if meta.get("text_endpoint")]-def _i2v_only_fal_families():- """Families that only animate an existing image (no text_endpoint)."""- from plugins.video_gen.fal import FAL_FAMILIES- return [fid for fid, meta in FAL_FAMILIES.items() if not meta.get("text_endpoint")]--@pytest.mark.parametrize("family_id", _t2v_fal_families())def test_fal_text_only_routes_to_text_endpoint(matrix_env, family_id):home, fal_calls, _ = matrix_env@@ -160,14 +154,6 @@ def test_fal_text_only_routes_to_text_endpoint(matrix_env, family_id):{"prompt": "a dog running"},)- # Image-only families (e.g. gemini-omni-flash) must reject text-only- # jobs with a clean modality error instead of submitting anywhere.- if not FAL_FAMILIES[family_id].get("text_endpoint"):- assert result["success"] is False, family_id- assert result.get("error_type") == "modality_unsupported", result- assert not fal_calls, f"{family_id} submitted despite no text endpoint"- return-assert result["success"] is True, f"{family_id}: {result.get('error')}"assert result["modality"] == "text"assert result["provider"] == "fal"@@ -183,22 +169,6 @@ def test_fal_text_only_routes_to_text_endpoint(matrix_env, family_id):assert not image_keys, f"{family_id} text-only leaked image keys: {image_keys}"[email protected]("family_id", _i2v_only_fal_families())-def test_fal_i2v_only_family_refuses_text_only(matrix_env, family_id):- """An i2v-only family must refuse a text-only call rather than guess an endpoint."""- home, fal_calls, _ = matrix_env-- result = _invoke_tool(- home,- {"video_gen": {"provider": "fal", "model": family_id}},- {"prompt": "a dog running"},- )-- assert result["success"] is False, f"{family_id} has no text-to-video route"- assert result.get("error_type") == "modality_unsupported"- assert not fal_calls, f"{family_id} must not reach FAL for an unsupported modality"--def _i2v_fal_families():"""Every family that can animate an existing image."""from plugins.video_gen.fal import FAL_FAMILIES