|
|
|
|
@ -37,6 +37,7 @@ def create_sample_agents():
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Initialization Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -114,7 +115,9 @@ def test_initialization_with_heavy_swarm_config():
|
|
|
|
|
|
|
|
|
|
assert router.swarm_type == "HeavySwarm"
|
|
|
|
|
assert router.heavy_swarm_loops_per_agent == 2
|
|
|
|
|
assert router.heavy_swarm_question_agent_model_name == "gpt-4o-mini"
|
|
|
|
|
assert (
|
|
|
|
|
router.heavy_swarm_question_agent_model_name == "gpt-4o-mini"
|
|
|
|
|
)
|
|
|
|
|
assert router.heavy_swarm_worker_model_name == "gpt-4o-mini"
|
|
|
|
|
assert router.heavy_swarm_swarm_show_output is False
|
|
|
|
|
|
|
|
|
|
@ -132,6 +135,7 @@ def test_initialization_with_agent_rearrange_config():
|
|
|
|
|
assert router.swarm_type == "AgentRearrange"
|
|
|
|
|
assert router.rearrange_flow == "ResearchAgent -> CodeAgent"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Configuration Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -160,6 +164,7 @@ def test_initialization_with_worker_tools():
|
|
|
|
|
|
|
|
|
|
assert router.worker_tools == []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Document Management Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -193,6 +198,7 @@ def test_router_with_documents():
|
|
|
|
|
assert router.documents[0].file_path == "/path/to/doc1.txt"
|
|
|
|
|
assert router.documents[1].file_path == "/path/to/doc2.txt"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Configuration Class Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -249,6 +255,7 @@ def test_router_with_config():
|
|
|
|
|
assert router.swarm_type == config.swarm_type
|
|
|
|
|
assert router.rules == config.rules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Basic Execution Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -297,6 +304,7 @@ def test_run_with_none_task():
|
|
|
|
|
result = router.run(None)
|
|
|
|
|
assert result is not None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Batch Processing Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -335,6 +343,7 @@ def test_batch_run_with_no_agents():
|
|
|
|
|
with pytest.raises(RuntimeError):
|
|
|
|
|
router.batch_run(["Test task"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Call Method Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -366,6 +375,7 @@ def test_call_with_image():
|
|
|
|
|
result = router("Describe this image", img=None)
|
|
|
|
|
assert result is not None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Output Type Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -385,6 +395,7 @@ def test_different_output_types():
|
|
|
|
|
result = router.run("Simple test task")
|
|
|
|
|
assert result is not None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Error Handling Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@ -413,9 +424,12 @@ def test_invalid_swarm_type():
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# But should raise ValueError during execution when creating swarm
|
|
|
|
|
with pytest.raises(ValueError, match="Invalid swarm type: InvalidSwarmType"):
|
|
|
|
|
with pytest.raises(
|
|
|
|
|
ValueError, match="Invalid swarm type: InvalidSwarmType"
|
|
|
|
|
):
|
|
|
|
|
router.run("Test task")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================================
|
|
|
|
|
# Integration Tests
|
|
|
|
|
# ============================================================================
|
|
|
|
|
|