feat: TenantSource 抽象——File源(测试/档案)与DB源(生产),registry 数据源可切换+reload upsert
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -136,6 +136,30 @@ def test_build_extractor_handles_none_info():
|
||||
assert "{}" in out # existing_info or {} 语义保留
|
||||
|
||||
|
||||
# ---- from_config(Phase 2 Task 4: 快照 prompts 组构造)----------------------
|
||||
|
||||
def test_from_config_missing_key_raises():
|
||||
# 缺一键 → 显性 ValueError 带键名(不留到 build_system 才炸)
|
||||
with pytest.raises(ValueError, match="company_facts"):
|
||||
PromptProvider.from_config(
|
||||
{"system": "s", "extractor": "e", "evaluator": "v"})
|
||||
|
||||
|
||||
def test_from_config_non_string_key_raises():
|
||||
# 值非字符串(JSON null 等)同样显性拒绝
|
||||
with pytest.raises(ValueError, match="system"):
|
||||
PromptProvider.from_config(
|
||||
{"system": None, "company_facts": "c",
|
||||
"extractor": "e", "evaluator": "v"})
|
||||
|
||||
|
||||
def test_from_config_equals_from_dir():
|
||||
d = JC_PROMPTS
|
||||
cfg = {name: (d / f"{name}.md").read_text(encoding="utf-8")
|
||||
for name in ("system", "company_facts", "extractor", "evaluator")}
|
||||
assert PromptProvider.from_config(cfg) == PromptProvider.from_dir(JC_PROMPTS)
|
||||
|
||||
|
||||
# ---- runtime 接线 --------------------------------------------------------
|
||||
|
||||
def test_registry_runtime_carries_prompts(tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user