job-research/tests/profile/test_merge.py

75 lines
2.5 KiB
Python

from job_research.profile.merge import build_candidate_profile_output
from job_research.profile.profile_parser import AuthoredProfile
def test_build_candidate_profile_output_writes_warning_when_facts_conflict() -> None:
cv_signals = {
"name": "Tonio",
"location": "France",
"languages": ["French", "English"],
"skills": ["Python", "SQL"],
"experience_entries": [{"title": "Data Engineer", "company": "A"}],
"education_entries": [],
"years_of_experience": 2,
}
authored = AuthoredProfile(
summary="Junior data engineer focused on GCP.",
target_roles=["Data Engineer"],
strengths=["Python"],
skills_to_emphasize=["BigQuery", "GCP"],
constraints=["CDI only"],
notes=["Years of experience feels closer to 3."],
)
output = build_candidate_profile_output(cv_signals, authored)
assert output.summary == "Junior data engineer focused on GCP."
assert output.constraints == ["CDI only"]
assert any(item.field == "years_of_experience" for item in output.warnings)
def test_build_candidate_profile_output_writes_warning_for_french_experience_note() -> None:
cv_signals = {
"name": "Tonio",
"location": "France",
"languages": ["French", "English"],
"skills": ["Python", "SQL"],
"experience_entries": [{"title": "Data Engineer", "company": "A"}],
"education_entries": [],
"years_of_experience": 2,
}
authored = AuthoredProfile(
summary="Junior data engineer focused on GCP.",
target_roles=["Data Engineer"],
strengths=["Python"],
skills_to_emphasize=["BigQuery", "GCP"],
constraints=["CDI only"],
notes=["Années d'expérience semble plus proche de 3."],
)
output = build_candidate_profile_output(cv_signals, authored)
assert any(item.field == "years_of_experience" for item in output.warnings)
def test_build_candidate_profile_output_warns_on_missing_core_cv_facts() -> None:
cv_signals = {
"location": "France",
"languages": ["French", "English"],
"skills": [],
"experience_entries": [],
"education_entries": [],
}
authored = AuthoredProfile(
summary="Junior data engineer focused on GCP."
)
output = build_candidate_profile_output(cv_signals, authored)
assert [item.field for item in output.warnings] == [
"name",
"experience_entries",
"skills",
"education_entries",
]