generated from kgod/ai-review-template
feat: improve resume optimization and import reliability
This commit is contained in:
@@ -90,19 +90,21 @@ def test_detail_gate_passes_facts_and_low_confidence_through() -> None:
|
||||
assert llm_detail_route(shaky, _profile_with_draft(), "跳过") is None
|
||||
|
||||
|
||||
def test_candidate_rewrite_ensure_facts_appends_missing() -> None:
|
||||
def test_candidate_rewrite_never_appends_raw_missing_facts() -> None:
|
||||
class _Expander:
|
||||
def expand(self, entry: dict[str, Any], *, context: dict[str, Any]) -> dict[str, Any]:
|
||||
return {"optimized_description": "主修课程:数据结构、计算机视觉。", "source": "test"}
|
||||
return {
|
||||
"optimized_description": "\u4e3b\u4fee\u8bfe\u7a0b\uff1a\u6570\u636e\u7ed3\u6784\u3001\u8ba1\u7b97\u673a\u89c6\u89c9\u3002",
|
||||
"uncovered_facts": ["GPA: 4.3/5.0"],
|
||||
"source": "test",
|
||||
}
|
||||
|
||||
agent = SimpleNamespace(expander=_Expander())
|
||||
proposal = _candidate_rewrite(
|
||||
agent,
|
||||
SimpleNamespace(expander=_Expander()),
|
||||
{"job_type": "campus"},
|
||||
{"description": "学习数据结构、计算机视觉课程。GPA: 4.3/5.0,排名前百分之10。"},
|
||||
{"description": "\u5b66\u4e60\u6570\u636e\u7ed3\u6784\u3001\u8ba1\u7b97\u673a\u89c6\u89c9\u8bfe\u7a0b\u3002GPA: 4.3/5.0\u3002"},
|
||||
"education",
|
||||
ensure_facts=True,
|
||||
)
|
||||
assert "GPA: 4.3/5.0" in proposal["optimized_description"]
|
||||
assert "排名前百分之10" in proposal["optimized_description"]
|
||||
assert proposal["uncovered_facts"] == []
|
||||
|
||||
assert "GPA: 4.3/5.0" not in proposal["optimized_description"]
|
||||
assert proposal["uncovered_facts"] == ["GPA: 4.3/5.0"]
|
||||
Reference in New Issue
Block a user