[claude] Fix pre-existing ruff lint errors blocking git hooks (#1247) (#1248)
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled

This commit was merged in pull request #1248.
This commit is contained in:
2026-03-23 23:33:37 +00:00
parent fedd164686
commit b5fb6a85cf
23 changed files with 116 additions and 130 deletions

View File

@@ -49,8 +49,10 @@ def test_nexus_chat_posts_message(client):
def test_nexus_teach_stores_fact(client):
"""POST /nexus/teach should persist a fact and return confirmation."""
with patch("dashboard.routes.nexus.store_personal_fact") as mock_store, \
patch("dashboard.routes.nexus.recall_personal_facts_with_ids", return_value=[]):
with (
patch("dashboard.routes.nexus.store_personal_fact") as mock_store,
patch("dashboard.routes.nexus.recall_personal_facts_with_ids", return_value=[]),
):
mock_store.return_value = None
response = client.post("/nexus/teach", data={"fact": "Timmy loves Python"})
assert response.status_code == 200

View File

@@ -1,7 +1,5 @@
"""Tests for Qwen3 dual-model task complexity classifier."""
import pytest
from infrastructure.router.classifier import TaskComplexity, classify_task

View File

@@ -39,9 +39,7 @@ class TestPrepareExperiment:
from timmy.autoresearch import prepare_experiment
with patch("timmy.autoresearch.subprocess.run") as mock_run:
mock_run.return_value = MagicMock(
returncode=1, stdout="", stderr="auth failed"
)
mock_run.return_value = MagicMock(returncode=1, stdout="", stderr="auth failed")
result = prepare_experiment(tmp_path)
assert "failed" in result.lower()
@@ -104,9 +102,7 @@ class TestRunExperiment:
(repo_dir / "train.py").write_text("print('done')")
with patch("timmy.autoresearch.subprocess.run") as mock_run:
mock_run.return_value = MagicMock(
returncode=0, stdout="no metrics here", stderr=""
)
mock_run.return_value = MagicMock(returncode=0, stdout="no metrics here", stderr="")
result = run_experiment(tmp_path)
assert result["success"] is True

View File

@@ -572,7 +572,9 @@ class TestMemoryStore:
mock_vector_store["store"].reset_mock()
# Test with 'research'
result = memory_store(topic="Similar research", report="Similar research content", type="research")
result = memory_store(
topic="Similar research", report="Similar research content", type="research"
)
assert "similar" in result.lower() or "duplicate" in result.lower()
mock_vector_store["store"].assert_not_called()
@@ -600,7 +602,9 @@ class TestMemoryStore:
valid_types = ["fact", "conversation", "document", "research"]
for ctx_type in valid_types:
mock_vector_store["store"].reset_mock()
memory_store(topic=f"Topic for {ctx_type}", report=f"Content for {ctx_type}", type=ctx_type)
memory_store(
topic=f"Topic for {ctx_type}", report=f"Content for {ctx_type}", type=ctx_type
)
mock_vector_store["store"].assert_called_once()
def test_memory_store_strips_report_and_adds_topic(self, mock_vector_store):

View File

@@ -190,7 +190,7 @@ class TestThreeStrikeStore:
@pytest.mark.unit
def test_get_events_respects_limit(self, store):
for i in range(5):
for _ in range(5):
try:
store.record("vlm_prompt_edit", "el")
except ThreeStrikeError:

View File

@@ -72,9 +72,7 @@ class TestThreeStrikeRoutes:
"/sovereignty/three-strike/record",
json={"category": "vlm_prompt_edit", "key": "events_test_key"},
)
response = client.get(
"/sovereignty/three-strike/vlm_prompt_edit/events_test_key/events"
)
response = client.get("/sovereignty/three-strike/vlm_prompt_edit/events_test_key/events")
assert response.status_code == 200
data = response.json()
assert data["category"] == "vlm_prompt_edit"

View File

@@ -310,7 +310,9 @@ class TestResearchOrchestrator:
mock_llm_client = MagicMock()
mock_llm_client.completion = AsyncMock(return_value=mock_llm_response)
with patch("timmy.paperclip.google_web_search", new=AsyncMock(return_value=mock_search_results)):
with patch(
"timmy.paperclip.google_web_search", new=AsyncMock(return_value=mock_search_results)
):
with patch("timmy.paperclip.get_llm_client", return_value=mock_llm_client):
report = await orchestrator.run_research_pipeline("test query")
@@ -358,7 +360,10 @@ class TestResearchOrchestrator:
orchestrator.run_research_pipeline = AsyncMock(return_value=mock_report)
orchestrator.post_gitea_comment = AsyncMock()
with patch("timmy.paperclip.triage_research_report", new=AsyncMock(return_value=mock_triage_results)):
with patch(
"timmy.paperclip.triage_research_report",
new=AsyncMock(return_value=mock_triage_results),
):
result = await orchestrator.run({"issue_number": 42})
assert "Research complete for issue #42" in result
@@ -500,7 +505,9 @@ class TestPaperclipPoller:
assert poller.client.update_task_status.call_count == 2
poller.client.update_task_status.assert_any_call("task-1", "running")
poller.client.update_task_status.assert_any_call("task-1", "completed", "Research completed successfully")
poller.client.update_task_status.assert_any_call(
"task-1", "completed", "Research completed successfully"
)
poller.orchestrator.run.assert_called_once_with({"issue_number": 42})
@pytest.mark.asyncio

View File

@@ -321,7 +321,10 @@ async def test_run_cycle_counts_dispatched_issues():
patch(
"timmy.vassal.backlog.fetch_open_issues",
new_callable=AsyncMock,
return_value=[{"number": i, "title": f"Issue {i}", "labels": [], "assignees": []} for i in range(1, 4)],
return_value=[
{"number": i, "title": f"Issue {i}", "labels": [], "assignees": []}
for i in range(1, 4)
],
),
patch(
"timmy.vassal.backlog.triage_issues",
@@ -357,7 +360,10 @@ async def test_run_cycle_respects_max_dispatch_cap():
patch(
"timmy.vassal.backlog.fetch_open_issues",
new_callable=AsyncMock,
return_value=[{"number": i, "title": f"Issue {i}", "labels": [], "assignees": []} for i in range(1, 6)],
return_value=[
{"number": i, "title": f"Issue {i}", "labels": [], "assignees": []}
for i in range(1, 6)
],
),
patch(
"timmy.vassal.backlog.triage_issues",
@@ -392,6 +398,8 @@ def test_resolve_interval_uses_explicit_value():
def test_resolve_interval_falls_back_to_300():
orch = VassalOrchestrator()
with patch("timmy.vassal.orchestration_loop.VassalOrchestrator._resolve_interval") as mock_resolve:
with patch(
"timmy.vassal.orchestration_loop.VassalOrchestrator._resolve_interval"
) as mock_resolve:
mock_resolve.return_value = 300.0
assert orch._resolve_interval() == 300.0