Claude commited on
Commit
83ee934
·
unverified ·
1 Parent(s): b93f9a0

refactor(tests): Strengthen assertions for professional test quality

Browse files

- test_graph_execution_flow: Replace weak catch-all assertion with
explicit verification of node execution sequence and output structure

- Use next(iter(e.keys())) per Ruff RUF015 best practice

Tests now explicitly verify:
- Minimum event count (>= 3)
- All critical nodes executed (supervisor, search, synthesize)
- Final event is synthesis node
- Synthesis produces messages output

tests/integration/graph/test_workflow.py CHANGED
@@ -70,13 +70,22 @@ async def test_graph_execution_flow(mocker):
70
  async for event in graph.astream(initial_state):
71
  events.append(event)
72
 
73
- # Verify flow
74
- # 1. Supervisor (start) -> decides search
75
- # 2. Search node runs
76
- # 3. Supervisor runs again -> max_iter reached -> synthesize
77
- # 4. Synthesize runs
78
- # 5. End
79
-
80
- # Just check we hit synthesis
 
 
 
81
  final_event = events[-1]
82
- assert "synthesize" in final_event or "messages" in str(final_event)
 
 
 
 
 
 
 
70
  async for event in graph.astream(initial_state):
71
  events.append(event)
72
 
73
+ # Verify flow executed correctly
74
+ # Expected sequence: supervisor -> search -> supervisor -> search -> supervisor -> synthesize
75
+ assert len(events) >= 3, f"Expected at least 3 events, got {len(events)}"
76
+
77
+ # Verify we executed key nodes
78
+ node_names = [next(iter(e.keys())) for e in events]
79
+ assert "supervisor" in node_names, "Supervisor node should have executed"
80
+ assert "search" in node_names, "Search node should have executed"
81
+ assert "synthesize" in node_names, "Synthesize node should have executed"
82
+
83
+ # Verify final event is synthesis (the terminal node)
84
  final_event = events[-1]
85
+ assert "synthesize" in final_event, (
86
+ f"Final event should be synthesis, got: {list(final_event.keys())}"
87
+ )
88
+
89
+ # Verify synthesis produced messages (the report markdown)
90
+ synth_output = final_event.get("synthesize", {})
91
+ assert "messages" in synth_output, "Synthesis should produce messages"