Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/test_generator_profile_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from taosmd import agents


Expand All @@ -10,3 +12,22 @@ def test_agent_generator_profile_roundtrip(tmp_path):
assert agents.get_agent_generator_profile("alice", data_dir=tmp_path) == "factual-recall"
agents.set_agent_generator_profile("alice", None, data_dir=tmp_path)
assert agents.get_agent_generator_profile("alice", data_dir=tmp_path) is None


def test_set_agent_generator_profile_unknown_agent_raises(tmp_path):
agents.AgentRegistry(tmp_path).register_agent("real")
with pytest.raises(agents.AgentNotFoundError):
agents.set_agent_generator_profile("ghost", "factual-recall", data_dir=tmp_path)


def test_get_agent_generator_profile_unknown_agent_raises(tmp_path):
agents.AgentRegistry(tmp_path).register_agent("real")
with pytest.raises(agents.AgentNotFoundError):
agents.get_agent_generator_profile("ghost", data_dir=tmp_path)


def test_set_agent_generator_profile_empty_string_clears(tmp_path):
agents.AgentRegistry(tmp_path).register_agent("bob")
agents.set_agent_generator_profile("bob", "factual-recall", data_dir=tmp_path)
agents.set_agent_generator_profile("bob", "", data_dir=tmp_path)
assert agents.get_agent_generator_profile("bob", data_dir=tmp_path) is None
10 changes: 10 additions & 0 deletions tests/test_generator_profile_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from taosmd import config


Expand All @@ -7,3 +9,11 @@ def test_generator_profile_roundtrip(tmp_path):
assert config.get_generator_profile(data_dir=tmp_path) == "factual-recall"
config.set_generator_profile("", clear=True, data_dir=tmp_path)
assert config.get_generator_profile(data_dir=tmp_path) is None


def test_set_generator_profile_rejects_blank_and_nonstr(tmp_path):
# clear=False with a blank or non-string id must raise and persist nothing.
for bad in ("", " ", 123, None):
with pytest.raises(ValueError):
config.set_generator_profile(bad, data_dir=tmp_path)
assert config.get_generator_profile(data_dir=tmp_path) is None