代码提交
This commit is contained in:
1 parent
d93cc62806
commit
ddf83f7728
25 files changed
+4086
-424
No files matched your search
@@ -10,7 +10,7 @@ from __future__ import annotations
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from deerflow.config.maf_roundtable_config import MafRoundtableConfig
|
||||
from deerflow.config.maf_roundtable_config import MafBusinessRoute, MafRoundtableConfig
|
||||
|
||||
|
||||
def test_valid_config_loads():
|
||||
@@ -57,3 +57,46 @@ def test_default_max_rounds_above_cap_rejected():
|
||||
def test_allow_mock_events_field_removed():
|
||||
"""allow_mock_events must not be a config field anymore."""
|
||||
assert "allow_mock_events" not in MafRoundtableConfig.model_fields
|
||||
|
||||
|
||||
def test_route_ids_are_trimmed_and_manager_cannot_be_a_seat():
|
||||
cfg = MafRoundtableConfig(
|
||||
default_manager_agent_id=" manager ",
|
||||
default_seat_agent_ids=[" seat-a "],
|
||||
business_routes={
|
||||
" 6BF ": MafBusinessRoute(
|
||||
manager_agent_id="route-manager",
|
||||
seat_agent_ids=["route-seat"],
|
||||
)
|
||||
},
|
||||
)
|
||||
assert cfg.default_manager_agent_id == "manager"
|
||||
assert cfg.default_seat_agent_ids == ["seat-a"]
|
||||
assert "6BF" in cfg.business_routes
|
||||
|
||||
with pytest.raises(ValidationError, match="must not appear"):
|
||||
MafRoundtableConfig(
|
||||
default_manager_agent_id="manager",
|
||||
default_seat_agent_ids=["manager"],
|
||||
)
|
||||
with pytest.raises(ValidationError, match="default_manager_agent_id"):
|
||||
MafRoundtableConfig(default_manager_agent_id=" ")
|
||||
|
||||
|
||||
def test_duplicate_seats_and_invalid_business_code_are_rejected():
|
||||
with pytest.raises(ValidationError, match="duplicates"):
|
||||
MafRoundtableConfig(default_seat_agent_ids=["seat-a", "seat-a"])
|
||||
with pytest.raises(ValidationError, match="business route code"):
|
||||
MafRoundtableConfig(
|
||||
business_routes={
|
||||
"not valid": MafBusinessRoute(manager_agent_id="manager")
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_route_seat_count_obeys_global_limit():
|
||||
with pytest.raises(ValidationError, match="max_seats_per_run"):
|
||||
MafRoundtableConfig(
|
||||
max_seats_per_run=1,
|
||||
default_seat_agent_ids=["seat-a", "seat-b"],
|
||||
)
|
||||
Reference in new issue
Block a user