20 lines
731 B
Python
20 lines
731 B
Python
"""Rippling's word table for prep: the words of `employmentType.label`."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import importlib
|
|
|
|
rippling = importlib.import_module("app.prep.hosts.rippling")
|
|
|
|
|
|
def _match(label: str) -> str | None:
|
|
"""The first entry of `MATCH` found among the "_"-separated words of a label."""
|
|
words = set(label.strip().lower().split("_"))
|
|
return next((value for token, value in rippling.MATCH if token in words), None)
|
|
|
|
|
|
def test_employment_labels_read_by_their_words() -> None:
|
|
assert [_match(w) for w in ("SALARIED_FT", "HOURLY_PT", "INTERN", "CONTRACTOR",
|
|
"SEASONAL", "ODD")] == [
|
|
"full_time", "part_time", "internship", "contract", "temporary", None]
|