diff --git a/shared/db_logging.py b/shared/db_logging.py index 3bf586a12..007c2c897 100644 --- a/shared/db_logging.py +++ b/shared/db_logging.py @@ -132,9 +132,7 @@ def _parse_quantum_summary() -> dict[str, Any]: return {} -def log_quantum_run_safe( - job, result: dict[str, Any], dataset_name: str, log_path: str -) -> dict[str, Any]: # noqa: ANN001 +def log_quantum_run_safe(job, result: dict[str, Any], dataset_name: str, log_path: str) -> dict[str, Any]: # noqa: ANN001 """Best-effort quantum run logging; returns a skip/error dict on failure.""" conn = _get_conn() if not conn: diff --git a/tests/test_agent_mode_delegation_contracts.py b/tests/test_agent_mode_delegation_contracts.py index 95aacf559..9dbb22d89 100644 --- a/tests/test_agent_mode_delegation_contracts.py +++ b/tests/test_agent_mode_delegation_contracts.py @@ -153,9 +153,9 @@ def test_alias_sources_exist_as_alternate_mode_agent_names() -> None: assert sources, "Expected alias source entries in alias section" available = {n for n in (_extract_agent_name(p) for p in AGENTS_DIR.glob("*.agent.md")) if n} missing_sources = sorted({s for s in sources if s not in available}) - assert ( - not missing_sources - ), f"Alias source names should map to existing alternate-mode agent names: {missing_sources}" + assert not missing_sources, ( + f"Alias source names should map to existing alternate-mode agent names: {missing_sources}" + ) @pytest.mark.unit diff --git a/tests/test_aria_auto_execute_html.py b/tests/test_aria_auto_execute_html.py index 0c0ad5412..e039b733a 100644 --- a/tests/test_aria_auto_execute_html.py +++ b/tests/test_aria_auto_execute_html.py @@ -35,9 +35,9 @@ def test_auto_execute_settings_persistence_wiring_present() -> None: assert "aria-autoexec-use-llm" in html, "Auto-execute should persist use-llm toggle" assert "aria-autoexec-show-state" in html, "Auto-execute should persist show-state toggle" assert "restoreAutoExecuteSettings()" in html, "Auto-execute should restore saved settings on load" - assert ( - "persistAutoExecuteSettings(provider, model, useLlm, showState)" in html - ), "Auto-execute should persist settings before requests" + assert "persistAutoExecuteSettings(provider, model, useLlm, showState)" in html, ( + "Auto-execute should persist settings before requests" + ) def test_auto_execute_quantum_toolbar_and_presets() -> None: diff --git a/tests/test_aria_index_provider_wiring.py b/tests/test_aria_index_provider_wiring.py index 1b81071aa..fd2a8f1eb 100644 --- a/tests/test_aria_index_provider_wiring.py +++ b/tests/test_aria_index_provider_wiring.py @@ -19,15 +19,15 @@ def test_index_has_provider_and_model_controls() -> None: def test_controller_reads_override_inputs() -> None: js = CONTROLLER_JS.read_text(encoding="utf-8") - assert ( - 'getElementById("providerSelect")' in js or "getElementById('providerSelect')" in js - ), "Controller should read provider selector" - assert ( - 'getElementById("modelInput")' in js or "getElementById('modelInput')" in js - ), "Controller should read model/path input" - assert ( - 'getElementById("useLlmToggle")' in js or "getElementById('useLlmToggle')" in js - ), "Controller should read LLM toggle" + assert 'getElementById("providerSelect")' in js or "getElementById('providerSelect')" in js, ( + "Controller should read provider selector" + ) + assert 'getElementById("modelInput")' in js or "getElementById('modelInput')" in js, ( + "Controller should read model/path input" + ) + assert 'getElementById("useLlmToggle")' in js or "getElementById('useLlmToggle')" in js, ( + "Controller should read LLM toggle" + ) def test_controller_forwards_overrides_to_command_endpoint() -> None: @@ -45,9 +45,9 @@ def test_controller_persists_provider_settings_in_localstorage() -> None: assert "aria-model-input" in js, "Controller should persist model/path" assert "aria-use-llm-toggle" in js, "Controller should persist use_llm toggle" assert "restoreProviderSettings()" in js, "Controller should restore provider settings on load" - assert ( - "persistProviderSettings(provider, model, useLlm)" in js - ), "Controller should persist settings before requests" + assert "persistProviderSettings(provider, model, useLlm)" in js, ( + "Controller should persist settings before requests" + ) def test_index_loads_stage_controller_and_threejs() -> None: diff --git a/tests/test_aria_server.py b/tests/test_aria_server.py index 398977a86..1f8a50b9e 100644 --- a/tests/test_aria_server.py +++ b/tests/test_aria_server.py @@ -18,9 +18,9 @@ def test_generate_tags_fallback_say_detection(): tags = aria_server.generate_tags_fallback("please say hello everyone") # We expect at least one say tag - assert any( - re.match(r"^\[aria:say:.*hello everyone.*\]$", t, flags=re.I) for t in tags - ), f"Expected say tag in {tags}" + assert any(re.match(r"^\[aria:say:.*hello everyone.*\]$", t, flags=re.I) for t in tags), ( + f"Expected say tag in {tags}" + ) def test_determine_position_for_pickup(): @@ -78,12 +78,12 @@ def test_parse_with_fallback_follow_me_adds_nod_and_move(): parser = aria_server.AriaActionParser() actions = parser.parse_with_fallback("follow me") - assert any( - a.get("action") == "gesture" and a.get("gesture_type") == "nod" for a in actions - ), f"Expected nod gesture for 'follow me' but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 75} for a in actions - ), f"Expected move action for 'follow me' but got {actions}" + assert any(a.get("action") == "gesture" and a.get("gesture_type") == "nod" for a in actions), ( + f"Expected nod gesture for 'follow me' but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 75} for a in actions), ( + f"Expected move action for 'follow me' but got {actions}" + ) def test_determine_position_bring_me_command(): @@ -96,15 +96,15 @@ def test_parse_with_fallback_bring_me_object_sequence(): actions = parser.parse_with_fallback("bring me the cup") cup_pos = aria_server.stage_state["objects"]["cup"]["position"] - assert any( - a.get("action") == "move" and a.get("target") == cup_pos for a in actions - ), f"Expected move-to-cup action but got {actions}" - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup-cup action but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected delivery move action but got {actions}" + assert any(a.get("action") == "move" and a.get("target") == cup_pos for a in actions), ( + f"Expected move-to-cup action but got {actions}" + ) + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup-cup action but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected delivery move action but got {actions}" + ) def test_determine_position_bring_it_command(): @@ -119,12 +119,12 @@ def test_parse_with_fallback_bring_it_when_holding(): aria_server.stage_state["aria"]["held_object"] = "book" actions = parser.parse_with_fallback("bring it here") - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected delivery move action for bring-it but got {actions}" - assert any( - a.get("action") == "gesture" and a.get("gesture_type") == "nod" for a in actions - ), f"Expected nod gesture for bring-it but got {actions}" + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected delivery move action for bring-it but got {actions}" + ) + assert any(a.get("action") == "gesture" and a.get("gesture_type") == "nod" for a in actions), ( + f"Expected nod gesture for bring-it but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -155,12 +155,12 @@ def test_parse_with_fallback_drop_here_when_holding(): aria_server.stage_state["aria"]["held_object"] = "cup" actions = parser.parse_with_fallback("drop it here") - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected move-to-drop-target action but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 50, "y": 85} for a in actions - ), f"Expected drop action at front-center but got {actions}" + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected move-to-drop-target action but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 50, "y": 85} for a in actions), ( + f"Expected drop action at front-center but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -172,9 +172,9 @@ def test_parse_with_fallback_drop_here_when_not_holding(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("put it here") - assert any( - a.get("action") == "say" and "not holding anything" in a.get("text", "").lower() for a in actions - ), f"Expected explanatory say action but got {actions}" + assert any(a.get("action") == "say" and "not holding anything" in a.get("text", "").lower() for a in actions), ( + f"Expected explanatory say action but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -186,15 +186,15 @@ def test_parse_with_fallback_compound_pickup_bring_drop_table(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup and bring it here then put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup action for cup but got {actions}" - assert any( - a.get("action") == "gesture" and a.get("gesture_type") == "nod" for a in actions - ), f"Expected nod gesture in compound flow but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected drop-on-table action but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup action for cup but got {actions}" + ) + assert any(a.get("action") == "gesture" and a.get("gesture_type") == "nod" for a in actions), ( + f"Expected nod gesture in compound flow but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected drop-on-table action but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -218,9 +218,9 @@ def test_parse_with_fallback_compound_drop_clears_planned_held_object(): aria_server.stage_state["aria"]["held_object"] = "cup" actions = parser.parse_with_fallback("drop it here then bring it here") say_actions = [a for a in actions if a.get("action") == "say"] - assert any( - "pick something up first" in a.get("text", "").lower() for a in say_actions - ), f"Expected bring-it guidance after planned drop but got {actions}" + assert any("pick something up first" in a.get("text", "").lower() for a in say_actions), ( + f"Expected bring-it guidance after planned drop but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -232,12 +232,12 @@ def test_parse_with_fallback_temporal_separator_after_that(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup after that bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in after-that sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in after-that sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in after-that sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in after-that sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -249,12 +249,12 @@ def test_parse_with_fallback_temporal_separator_finally(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup finally bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in finally sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in finally sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in finally sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in finally sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -266,12 +266,12 @@ def test_parse_with_fallback_temporal_separator_lastly(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup lastly bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in lastly sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in lastly sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in lastly sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in lastly sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -283,12 +283,12 @@ def test_parse_with_fallback_temporal_separator_first_second(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("first pick up cup second bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in first/second sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in first/second sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in first/second sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in first/second sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -300,12 +300,12 @@ def test_parse_with_fallback_temporal_separator_first_second_finally(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("first pick up cup second bring it here finally put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in first/second/finally sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected final table drop in first/second/finally sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in first/second/finally sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected final table drop in first/second/finally sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -317,12 +317,12 @@ def test_parse_with_fallback_temporal_separator_step_numbers(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("step 1 pick up cup step 2 bring it here step 3 put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in step-number sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in step-number sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in step-number sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in step-number sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -334,12 +334,12 @@ def test_parse_with_fallback_temporal_separator_step_numbers_compact(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("step1 pick up cup step2 bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in compact-step sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in compact-step sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in compact-step sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in compact-step sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -351,12 +351,12 @@ def test_parse_with_fallback_temporal_separator_step_roman_numerals(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("step I pick up cup step II bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in Roman step sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in Roman step sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in Roman step sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in Roman step sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -368,12 +368,12 @@ def test_parse_with_fallback_temporal_separator_numbered_list_markers(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("1) pick up cup 2) bring it here 3) put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in numbered-list sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in numbered-list sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in numbered-list sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in numbered-list sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -385,12 +385,12 @@ def test_parse_with_fallback_temporal_separator_phase_numbers(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("phase 1 pick up cup phase 2 bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in phase-number sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in phase-number sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in phase-number sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in phase-number sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -402,12 +402,12 @@ def test_parse_with_fallback_temporal_separator_part_roman_numerals(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("part I pick up cup part II put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in part-Roman sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in part-Roman sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in part-Roman sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in part-Roman sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -419,12 +419,12 @@ def test_parse_with_fallback_temporal_separator_ascii_arrow_flow(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup -> bring it here => put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in ASCII arrow sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in ASCII arrow sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in ASCII arrow sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in ASCII arrow sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -436,12 +436,12 @@ def test_parse_with_fallback_temporal_separator_unicode_arrow_flow(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup → bring it here") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in Unicode arrow sequence but got {actions}" - assert any( - a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions - ), f"Expected bring-it move in Unicode arrow sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in Unicode arrow sequence but got {actions}" + ) + assert any(a.get("action") == "move" and a.get("target") == {"x": 50, "y": 85} for a in actions), ( + f"Expected bring-it move in Unicode arrow sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -453,12 +453,12 @@ def test_parse_with_fallback_temporal_separator_newline_bullets(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup\n- bring it here\n- put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in newline-bullet sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in newline-bullet sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in newline-bullet sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in newline-bullet sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -470,12 +470,12 @@ def test_parse_with_fallback_temporal_separator_then_next_labels(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup then: bring it here next: put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in then/next-label sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in then/next-label sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in then/next-label sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in then/next-label sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -487,12 +487,12 @@ def test_parse_with_fallback_temporal_separator_afterward_finally_labels(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup afterward: bring it here finally: put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in afterward/finally-label sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in afterward/finally-label sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in afterward/finally-label sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in afterward/finally-label sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -504,12 +504,12 @@ def test_parse_with_fallback_temporal_separator_newline_checkbox_bullets(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup\n- [ ] bring it here\n- [x] put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in checkbox-bullet sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in checkbox-bullet sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in checkbox-bullet sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in checkbox-bullet sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -521,12 +521,12 @@ def test_parse_with_fallback_temporal_separator_pipe_chain(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup | bring it here | put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in pipe-chain sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in pipe-chain sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in pipe-chain sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in pipe-chain sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -538,12 +538,12 @@ def test_parse_with_fallback_temporal_separator_mixed_pipe_and_arrows(): aria_server.stage_state["aria"]["held_object"] = None actions = parser.parse_with_fallback("pick up cup | bring it here -> put it on table") - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup in mixed pipe/arrow sequence but got {actions}" - assert any( - a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions - ), f"Expected table drop in mixed pipe/arrow sequence but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup in mixed pipe/arrow sequence but got {actions}" + ) + assert any(a.get("action") == "drop" and a.get("position") == {"x": 60, "y": 35} for a in actions), ( + f"Expected table drop in mixed pipe/arrow sequence but got {actions}" + ) finally: aria_server.stage_state["aria"]["held_object"] = original_held @@ -674,9 +674,9 @@ def test_sparkle_effect_with_synonyms(): ] for cmd in test_commands: tags = aria_server.generate_tags_fallback(cmd) - assert any( - "[aria:effect:sparkle" in t for t in tags - ), f"Expected sparkle effect tag for command '{cmd}' but got {tags}" + assert any("[aria:effect:sparkle" in t for t in tags), ( + f"Expected sparkle effect tag for command '{cmd}' but got {tags}" + ) def test_sparkle_intensity_light(): @@ -684,17 +684,17 @@ def test_sparkle_intensity_light(): test_commands = ["light sparkle", "subtle sparkle", "gentle shimmer"] for cmd in test_commands: tags = aria_server.generate_tags_fallback(cmd) - assert any( - "[aria:effect:sparkle:light]" in t for t in tags - ), f"Expected light intensity sparkle tag for '{cmd}' but got {tags}" + assert any("[aria:effect:sparkle:light]" in t for t in tags), ( + f"Expected light intensity sparkle tag for '{cmd}' but got {tags}" + ) def test_sparkle_intensity_normal(): """Test normal sparkle intensity (default)""" tags = aria_server.generate_tags_fallback("sparkle") - assert any( - "[aria:effect:sparkle:normal]" in t for t in tags - ), f"Expected normal intensity sparkle tag but got {tags}" + assert any("[aria:effect:sparkle:normal]" in t for t in tags), ( + f"Expected normal intensity sparkle tag but got {tags}" + ) def test_sparkle_intensity_heavy(): @@ -707,9 +707,9 @@ def test_sparkle_intensity_heavy(): ] for cmd in test_commands: tags = aria_server.generate_tags_fallback(cmd) - assert any( - "[aria:effect:sparkle:heavy]" in t for t in tags - ), f"Expected heavy intensity sparkle tag for '{cmd}' but got {tags}" + assert any("[aria:effect:sparkle:heavy]" in t for t in tags), ( + f"Expected heavy intensity sparkle tag for '{cmd}' but got {tags}" + ) def test_glow_effect_basic(): @@ -723,9 +723,9 @@ def test_glow_effect_synonyms(): test_commands = ["make it glow", "glowing effect", "radiate light", "illuminate"] for cmd in test_commands: tags = aria_server.generate_tags_fallback(cmd) - assert any( - "[aria:effect:glow" in t for t in tags - ), f"Expected glow effect tag for command '{cmd}' but got {tags}" + assert any("[aria:effect:glow" in t for t in tags), ( + f"Expected glow effect tag for command '{cmd}' but got {tags}" + ) def test_hearts_effect_basic(): @@ -739,9 +739,9 @@ def test_hearts_effect_synonyms(): test_commands = ["show hearts", "heart effect", "show some love"] for cmd in test_commands: tags = aria_server.generate_tags_fallback(cmd) - assert any( - "[aria:effect:hearts" in t for t in tags - ), f"Expected hearts effect tag for command '{cmd}' but got {tags}" + assert any("[aria:effect:hearts" in t for t in tags), ( + f"Expected hearts effect tag for command '{cmd}' but got {tags}" + ) def test_combined_dance_and_sparkle(): @@ -776,9 +776,9 @@ def test_effect_intensity_mutually_exclusive(): sparkle_tags = [t for t in tags if "[aria:effect:sparkle" in t] assert len(sparkle_tags) == 1, f"Expected exactly one sparkle tag but got {sparkle_tags}" # Light should be applied due to if-elif order (light is checked first) - assert ( - "[aria:effect:sparkle:light]" in sparkle_tags[0] - ), f"Expected light intensity to take precedence but got {sparkle_tags[0]}" + assert "[aria:effect:sparkle:light]" in sparkle_tags[0], ( + f"Expected light intensity to take precedence but got {sparkle_tags[0]}" + ) def test_action_to_tags_move_position_and_say() -> None: @@ -811,9 +811,9 @@ def fail_if_called(*args, **kwargs): actions = parser.parse("wave", use_llm=False) - assert any( - a.get("action") == "gesture" and a.get("gesture_type") == "wave" for a in actions - ), f"Expected fallback gesture action when use_llm=False but got {actions}" + assert any(a.get("action") == "gesture" and a.get("gesture_type") == "wave" for a in actions), ( + f"Expected fallback gesture action when use_llm=False but got {actions}" + ) def test_parse_accepts_quantum_llm_provider_alias(monkeypatch): @@ -893,26 +893,26 @@ def failing_detect_provider(explicit=None, model_override=None, **kwargs): model_override="data_out/quantum_llm_training", ) - assert any( - a.get("action") == "gesture" and a.get("gesture_type") == "wave" for a in actions - ), f"Expected fallback parser action but got {actions}" + assert any(a.get("action") == "gesture" and a.get("gesture_type") == "wave" for a in actions), ( + f"Expected fallback parser action but got {actions}" + ) def test_parse_with_fallback_supports_look_throw_and_wait_actions(): parser = aria_server.AriaActionParser() look_actions = parser.parse_with_fallback("look at the cup") - assert any( - a.get("action") == "look" and a.get("target") == "cup" for a in look_actions - ), f"Expected look-at-cup action but got {look_actions}" + assert any(a.get("action") == "look" and a.get("target") == "cup" for a in look_actions), ( + f"Expected look-at-cup action but got {look_actions}" + ) throw_actions = parser.parse_with_fallback("throw the ball") assert any(a.get("action") == "throw" for a in throw_actions), f"Expected throw action but got {throw_actions}" wait_actions = parser.parse_with_fallback("wave then wait 2 seconds") - assert any( - a.get("action") == "wait" and a.get("duration") == 2.0 for a in wait_actions - ), f"Expected wait action with duration but got {wait_actions}" + assert any(a.get("action") == "wait" and a.get("duration") == 2.0 for a in wait_actions), ( + f"Expected wait action with duration but got {wait_actions}" + ) def test_parse_with_fallback_pickup_and_bring_it_same_segment(): @@ -921,9 +921,9 @@ def test_parse_with_fallback_pickup_and_bring_it_same_segment(): actions = parser.parse_with_fallback("walk to cup and pick it up and bring it here") action_types = [a.get("action") for a in actions] - assert any( - a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions - ), f"Expected pickup action in same-segment bring-it command but got {actions}" + assert any(a.get("action") == "pickup" and a.get("object_id") == "cup" for a in actions), ( + f"Expected pickup action in same-segment bring-it command but got {actions}" + ) assert any( a.get("action") == "move" and isinstance(a.get("target"), dict) diff --git a/tests/test_consolidated_html.py b/tests/test_consolidated_html.py index e02531f58..b02bc1508 100644 --- a/tests/test_consolidated_html.py +++ b/tests/test_consolidated_html.py @@ -82,9 +82,9 @@ def test_card_not_inside_status_pills(self, html_text): assert gpu_ready_pos != -1, "GPU Ready pill not found" # The hyperopt container should come AFTER the GPU ready pill - assert ( - card_pos > gpu_ready_pos - ), "hyperoptContainer appears before/inside the status-pills header block; it should be in the Tools tab" + assert card_pos > gpu_ready_pos, ( + "hyperoptContainer appears before/inside the status-pills header block; it should be in the Tools tab" + ) def test_card_near_anomaly_detector(self, html_text): """Hyperopt card should appear shortly after the Anomaly Detector card.""" @@ -94,9 +94,9 @@ def test_card_near_anomaly_detector(self, html_text): assert hyperopt_pos != -1, "Hyperparameter Optimizer card not found" assert hyperopt_pos > anomaly_pos, "Hyperparameter Optimizer card should come after Anomaly Detector" # They should be reasonably close (within 2000 chars) - assert ( - hyperopt_pos - anomaly_pos < 2000 - ), "Hyperparameter Optimizer card is suspiciously far from Anomaly Detector" + assert hyperopt_pos - anomaly_pos < 2000, ( + "Hyperparameter Optimizer card is suspiciously far from Anomaly Detector" + ) def test_status_pills_has_three_pills(self, html_text): """Header status-pills block should contain exactly 3 .status-pill divs.""" @@ -152,9 +152,9 @@ def test_loadconfig_closes_before_hyperopt(self, html_lines): # The closing brace line of loadConfig is exactly " }" (8 spaces + "}") # Accept either 8-space or 12-space indent closing brace (depends on script tag indentation) close_lines = [line for line in between if re.match(r"^(?: | )\}$", line)] - assert ( - len(close_lines) >= 1 - ), "loadConfig() does not appear to close before startHyperparamOptimization — functions may still be nested" + assert len(close_lines) >= 1, ( + "loadConfig() does not appear to close before startHyperparamOptimization — functions may still be nested" + ) # --------------------------------------------------------------------------- @@ -179,9 +179,9 @@ def test_uses_safe_batch_size_key(self, html_text): def test_handles_no_gpu(self, html_text): """There should be error/warning handling for the no-GPU response path.""" - assert ( - "data.error" in html_text or "data.available" in html_text - ), "VRAM calculator should handle error/available=false from API" + assert "data.error" in html_text or "data.available" in html_text, ( + "VRAM calculator should handle error/available=false from API" + ) # --------------------------------------------------------------------------- diff --git a/tests/test_orchestrator_health_integration.py b/tests/test_orchestrator_health_integration.py index ca54e8b32..19046ce1b 100644 --- a/tests/test_orchestrator_health_integration.py +++ b/tests/test_orchestrator_health_integration.py @@ -87,9 +87,9 @@ def test_orchestrator_health_aggregates_autonomous_training(app_module: ModuleTy orchestrators = data["orchestrator_health"]["orchestrators"] # If status file exists, should be included - assert ( - "autonomous_training" in orchestrators - ), "autonomous_training orchestrator missing despite status file present." + assert "autonomous_training" in orchestrators, ( + "autonomous_training orchestrator missing despite status file present." + ) orch = orchestrators["autonomous_training"] assert "status" in orch assert "cycles_completed" in orch or "error" in orch diff --git a/tests/test_parallel_status.py b/tests/test_parallel_status.py index cb2043b2d..c8a191ad1 100644 --- a/tests/test_parallel_status.py +++ b/tests/test_parallel_status.py @@ -38,6 +38,6 @@ def test_parallel_status_structure(): # diversity_avg must equal score assert entry.get("diversity_avg") == entry.get("score"), "alias score mismatch" if metric == "perplexity_improvement" and "perplexity_improvement" in entry: - assert ( - pytest.approx(entry["perplexity_improvement"], rel=1e-3) == entry["score"] - ), "improvement score mismatch" + assert pytest.approx(entry["perplexity_improvement"], rel=1e-3) == entry["score"], ( + "improvement score mismatch" + ) diff --git a/tests/test_training_analytics_cli.py b/tests/test_training_analytics_cli.py index 06c6bb960..9d8308675 100644 --- a/tests/test_training_analytics_cli.py +++ b/tests/test_training_analytics_cli.py @@ -66,9 +66,9 @@ def test_training_analytics_report_pipe_head_with_pipefail_exits_zero() -> None: timeout=30, ) - assert ( - proc.returncode == 0 - ), f"expected zero exit with pipefail enabled, got {proc.returncode}; stderr={proc.stderr!r}" + assert proc.returncode == 0, ( + f"expected zero exit with pipefail enabled, got {proc.returncode}; stderr={proc.stderr!r}" + ) @pytest.mark.unit @@ -173,9 +173,9 @@ def test_training_analytics_chart_pipe_head_with_pipefail_exits_zero() -> None: timeout=30, ) - assert ( - proc.returncode == 0 - ), f"expected zero exit for chart mode under pipefail, got {proc.returncode}; stderr={proc.stderr!r}" + assert proc.returncode == 0, ( + f"expected zero exit for chart mode under pipefail, got {proc.returncode}; stderr={proc.stderr!r}" + ) @pytest.mark.unit @@ -194,6 +194,6 @@ def test_training_analytics_default_mode_pipe_head_with_pipefail_exits_zero() -> timeout=30, ) - assert ( - proc.returncode == 0 - ), f"expected zero exit for default mode under pipefail, got {proc.returncode}; stderr={proc.stderr!r}" + assert proc.returncode == 0, ( + f"expected zero exit for default mode under pipefail, got {proc.returncode}; stderr={proc.stderr!r}" + ) diff --git a/tests/test_ui_playwright.py b/tests/test_ui_playwright.py index bc4985d06..28967fcc9 100644 --- a/tests/test_ui_playwright.py +++ b/tests/test_ui_playwright.py @@ -141,9 +141,9 @@ def test_client_add_pickup_and_drag_updates_server(): # wait for server to report it obj = wait_for_object(unique_name, timeout=5.0) - assert ( - obj is not None - ), f"Server didn't report new object {unique_name}: {requests.get(SERVER_URL + '/api/aria/state').text}" + assert obj is not None, ( + f"Server didn't report new object {unique_name}: {requests.get(SERVER_URL + '/api/aria/state').text}" + ) # Now pick the object up using client function page.evaluate("(name) => pickUpObject(name)", unique_name)