Skip to content

Commit 2962e27

Browse files
committed
fix: correct test assertions to match actual deepagent.run() return value
- Fix tests expecting dict return from run() method to expect string - The run() method returns result['output'] (string), not the full dict - All deepagent tests now pass correctly - Maintains consistency with actual implementation behavior
1 parent 41e8122 commit 2962e27

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

test/e2e/test_parser_workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def test_cli_parses_file_in_dry_run(self):
5050
prompt = f"Parse the diagram in '{self.test_file}'"
5151
result = agent.run(prompt)
5252

53-
self.assertIn("Successfully parsed", result['output'])
54-
self.assertIn("1 elements", result['output'])
53+
self.assertIn("Successfully parsed", result)
54+
self.assertIn("1 elements", result)
5555

5656
if __name__ == '__main__':
5757
unittest.main()

test/unit/test_deepagent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ def test_sdlcflexibleagent_dry_run():
1212

1313
# Assert
1414
assert isinstance(agent.agent, deepagent.MockAgent)
15-
assert resp == {"output": "dry-run-echo:hello"}
15+
assert resp == "dry-run-echo:hello"

test/unit/test_deepagent_coverage.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ def test_run_method_invokes_agent(self):
3232
"""
3333
agent = SDLCFlexibleAgent(dry_run=True)
3434

35-
with patch.object(agent.agent, 'invoke', return_value="mocked_output") as mock_invoke:
35+
with patch.object(agent.agent, 'invoke', return_value={"output": "mocked_output"}) as mock_invoke:
3636
result = agent.run("test input")
37+
38+
mock_invoke.assert_called_once_with(
39+
{"input": "test input"},
40+
config={"configurable": {"session_id": "default"}}
41+
)
42+
assert result == "mocked_output"
3743
mock_invoke.assert_called_once_with(
3844
{"input": "test input"},
3945
config={"configurable": {"session_id": "default"}},

test/unit/test_deepagent_providers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ def test_dry_run_flag():
3737
agent = deepagent.SDLCFlexibleAgent(dry_run=True)
3838
assert agent.llm is None
3939
assert isinstance(agent.agent, deepagent.MockAgent)
40-
assert agent.run("test") == {"output": "dry-run-echo:test"}
40+
assert agent.run("test") == "dry-run-echo:test"

0 commit comments

Comments
 (0)