Readers oracle to workday and the providers hand on the host's words; their word tables move to app/prep/hosts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a66aac95cf
commit
06eb929eaf
48 files changed
+460
-388
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -24,6 +25,16 @@ from plugins.readers._shared import ( # noqa: E402
|
||||
#: The module-level names a reader keeps its employment words in.
|
||||
_TABLES = ("_EMPLOYMENT", "_CONTRACT", "_SCHEDULE")
|
||||
|
||||
#: The hosts whose word tables are prep's, in `app/prep/hosts/<name>.py`.
|
||||
_PREP_HOSTS = ("oracle", "personio", "phenom", "pinpoint", "recruitee", "rippling",
|
||||
"smartrecruiters", "teamtailor", "workable", "workday")
|
||||
|
||||
|
||||
def _prep_table(name: str, table_name: str):
|
||||
"""A word table of `app.prep.hosts.<name>`, or None where it has none."""
|
||||
module = importlib.import_module(f"app.prep.hosts.{name}")
|
||||
return getattr(module, table_name, None)
|
||||
|
||||
|
||||
def test_every_employment_table_maps_into_the_shared_vocabulary() -> None:
|
||||
found = 0
|
||||
@@ -36,9 +47,30 @@ def test_every_employment_table_maps_into_the_shared_vocabulary() -> None:
|
||||
values = table.values() if isinstance(table, dict) else [v for _k, v in table]
|
||||
# "" is a known word that names no employment ("permanent").
|
||||
assert set(values) <= {*EMPLOYMENTS, ""}, (name, table_name)
|
||||
for name in _PREP_HOSTS:
|
||||
for table_name in ("EMPLOYMENT", "MATCH"):
|
||||
table = _prep_table(name, table_name)
|
||||
if table is None:
|
||||
continue
|
||||
values = table.values() if isinstance(table, dict) else [v for _k, v in table]
|
||||
found += 1
|
||||
assert set(values) <= {*EMPLOYMENTS, ""}, (name, table_name)
|
||||
assert found >= 15
|
||||
|
||||
|
||||
def test_the_prep_tables_of_the_hosts_speak_the_apps_vocabulary() -> None:
|
||||
from app.models import SENIORITIES
|
||||
for name in _PREP_HOSTS:
|
||||
seniority = _prep_table(name, "SENIORITY")
|
||||
if seniority is not None:
|
||||
assert set(seniority.values()) <= {*SENIORITIES, ""}, name
|
||||
remote = _prep_table(name, "REMOTE")
|
||||
if remote is not None:
|
||||
assert set(remote.values()) <= {"remote", "hybrid", "onsite", ""}, name
|
||||
for table in (seniority, remote, _prep_table(name, "EMPLOYMENT")):
|
||||
assert table is None or all(k == k.lower() for k in table), name
|
||||
|
||||
|
||||
def test_the_vocabulary_is_the_documented_one() -> None:
|
||||
assert EMPLOYMENTS == ("full_time", "part_time", "contract", "temporary", "internship",
|
||||
"freelance")
|
||||
|
||||
Reference in new issue
Block a user