Spaces:
Running
Running
File size: 929 Bytes
2d01d7b c008e60 2d01d7b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from pathlib import Path
from talentry.io.candidates import load_candidates
from talentry.ranker import parse_job_description, rank_candidates
SAMPLE = Path(__file__).parent.parent / "data" / "raw" / "sample_candidates.json"
def test_pipeline_runs_on_sample_and_ranks_recsys_engineer_first():
cands = load_candidates(SAMPLE)
jd = parse_job_description(None)
ranked = rank_candidates(cands, jd, top_k=5)
assert len(ranked) == 5
# Ela Singh - explicit Recommendation Systems Engineer at Swiggy - should
# easily rank #1 against this JD on this sample.
assert ranked[0].candidate_id == "CAND_0000031"
assert ranked[0].score >= ranked[1].score
def test_scores_are_non_increasing():
cands = load_candidates(SAMPLE)
jd = parse_job_description(None)
ranked = rank_candidates(cands, jd, top_k=20)
scores = [r.score for r in ranked]
assert scores == sorted(scores, reverse=True)
|