"""Pinpoint's word tables for prep: `workplace_type` and `employment_type`.""" from __future__ import annotations import importlib pinpoint = importlib.import_module("app.prep.hosts.pinpoint") def _match(code: str) -> str | None: """The first entry of `MATCH` found in the lowercased code.""" code = code.strip().lower() return next((value for fragment, value in pinpoint.MATCH if fragment in code), None) def test_workplace_types_read() -> None: assert pinpoint.REMOTE == {"onsite": "onsite", "on_site": "onsite", "hybrid": "hybrid", "remote": "remote"} def test_employment_types_read_by_their_fragments() -> None: assert [_match(w) for w in ("permanent_full_time", "fixed_term_full_time", "permanent_part_time", "internship", "something_new")] == [ "full_time", "temporary", "part_time", "internship", None]