"""Recruitee's word tables for prep: the host's codes, and what they mean.""" from __future__ import annotations import importlib recruitee = importlib.import_module("app.prep.hosts.recruitee") def _match(word: str) -> str | None: """The first entry of `MATCH` found among the words of a code.""" words = set(word.strip().lower().replace("-", "_").split("_")) return next((value for fragment, value in recruitee.MATCH if fragment in words), None) def test_experience_codes_read() -> None: seniority = recruitee.SENIORITY assert [seniority[w] for w in ("student_school", "entry_level", "mid_level")] == [ "intern", "junior", "mid"] assert seniority["experienced"] == "" assert "senior_level" not in seniority def test_employment_type_codes_read_by_their_words() -> None: assert [_match(w) for w in ("fulltime_permanent", "parttime_permanent", "internship", "fulltime_fixed_term", "freelance", "odd_job")] == [ "full_time", "part_time", "internship", "temporary", "contract", None]