forked from molecule-ai/molecule-core
Fix test assertions to account for HMA instructions in system prompt
Mock get_hma_instructions in exact-match tests so they don't break when HMA content is appended. Add a dedicated test for HMA inclusion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6103ca341c
commit
5bc3edfbdd
@ -479,7 +479,8 @@ def test_build_system_prompt_combines_base_and_a2a_via_fixture():
|
||||
"""Direct test bypassing the execute() path."""
|
||||
e = _make_executor()
|
||||
with patch("claude_sdk_executor.get_system_prompt", return_value="BASE"), \
|
||||
patch("claude_sdk_executor.get_a2a_instructions", return_value="A2A"):
|
||||
patch("claude_sdk_executor.get_a2a_instructions", return_value="A2A"), \
|
||||
patch("claude_sdk_executor.get_hma_instructions", return_value=""):
|
||||
out = e._build_system_prompt()
|
||||
assert out == "BASE\n\nA2A"
|
||||
|
||||
@ -487,17 +488,31 @@ def test_build_system_prompt_combines_base_and_a2a_via_fixture():
|
||||
def test_build_system_prompt_base_only():
|
||||
e = _make_executor()
|
||||
with patch("claude_sdk_executor.get_system_prompt", return_value="BASE"), \
|
||||
patch("claude_sdk_executor.get_a2a_instructions", return_value=""):
|
||||
patch("claude_sdk_executor.get_a2a_instructions", return_value=""), \
|
||||
patch("claude_sdk_executor.get_hma_instructions", return_value=""):
|
||||
assert e._build_system_prompt() == "BASE"
|
||||
|
||||
|
||||
def test_build_system_prompt_a2a_only():
|
||||
e = _make_executor()
|
||||
with patch("claude_sdk_executor.get_system_prompt", return_value=None), \
|
||||
patch("claude_sdk_executor.get_a2a_instructions", return_value="A2A"):
|
||||
patch("claude_sdk_executor.get_a2a_instructions", return_value="A2A"), \
|
||||
patch("claude_sdk_executor.get_hma_instructions", return_value=""):
|
||||
assert e._build_system_prompt() == "A2A"
|
||||
|
||||
|
||||
def test_build_system_prompt_includes_hma():
|
||||
"""HMA instructions are appended when present."""
|
||||
e = _make_executor()
|
||||
with patch("claude_sdk_executor.get_system_prompt", return_value="BASE"), \
|
||||
patch("claude_sdk_executor.get_a2a_instructions", return_value="A2A"), \
|
||||
patch("claude_sdk_executor.get_hma_instructions", return_value="## Hierarchical Memory"):
|
||||
out = e._build_system_prompt()
|
||||
assert "BASE" in out
|
||||
assert "A2A" in out
|
||||
assert "## Hierarchical Memory" in out
|
||||
|
||||
|
||||
def test_prepare_prompt_no_delegation_returns_unchanged():
|
||||
e = _make_executor()
|
||||
with patch("claude_sdk_executor.read_delegation_results", return_value=""):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user