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:
WolfandClaude Opus 5.5 committed 2026-09-30 11:07:07 +02:00
1 parent a66aac95cf
commit 06eb929eaf
48 files changed
+460 -388

No files matched your search

+5 -23
View File
@@ -4,17 +4,14 @@ No network: the shapes are those of Bosch's board, read on 2026-09-30."""
from __future__ import annotations
import json
import logging
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app.models import SENIORITIES # noqa: E402
from plugins.readers import Ask, smartrecruiters # noqa: E402
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
@@ -54,38 +51,23 @@ def test_page_reads_by_offset_and_takes_the_ask() -> None:
def test_the_place_is_one_clean_line_with_its_remote_flag_and_country() -> None:
[row] = _rows(_posting())
assert row["places"] == [{"text": "Hatvan, Hungary", "remote": False}] # ", ," gone
assert row["location"] == "Hatvan, Hungary" and row["country"] == "HU"
assert row["location"] == "Hatvan, Hungary" and row["country"] == "hu"
[remote] = _rows(_posting(location={"remote": True, "fullLocation": "Remote", "country": ""}))
assert remote["places"] == [{"text": "Remote", "remote": True}] and remote["country"] is None
[none] = _rows(_posting(location={}))
assert none["places"] == [] and none["location"] == ""
def test_the_stated_level_and_employment_are_mapped() -> None:
def test_the_stated_level_and_employment_are_the_hosts_words() -> None:
[row] = _rows(_posting(experienceLevel={"id": "internship", "label": "Internship"},
typeOfEmployment={"id": "intern", "label": "Intern"}))
assert (row["seniority"], row["employment"]) == ("intern", "internship")
levels = {"entry_level": "junior", "director": "director", "executive": "exec",
"associate": None, "mid_senior_level": None, "not_applicable": None}
for word, want in levels.items():
[row] = _rows(_posting(experienceLevel={"id": word}))
assert row["seniority"] == want, word
[row] = _rows(_posting(typeOfEmployment={"id": "permanent"}))
assert row["employment"] is None
assert (row["seniority"], row["employment"]) == ("internship", "intern")
[row] = _rows(_posting(experienceLevel={"id": "mid_senior_level"}))
assert row["seniority"] == "mid_senior_level"
[row] = _rows(_posting())
assert row["seniority"] is None and row["employment"] is None
def test_the_table_speaks_the_apps_vocabulary_and_a_new_word_is_logged(
caplog: pytest.LogCaptureFixture) -> None:
assert {v for v in smartrecruiters._SENIORITY.values() if v} <= set(SENIORITIES)
with caplog.at_level(logging.DEBUG, logger=smartrecruiters.__name__):
[row] = _rows(_posting(experienceLevel={"id": "guru"}))
assert row["seniority"] is None
assert [r.getMessage() for r in caplog.records] == [
"smartrecruiters: unknown experienceLevel 'guru'"]
def test_the_saved_page_still_reads() -> None:
data = json.loads((FIXTURES / "smartrecruiters.json").read_bytes())
assert [r["location"] for r in smartrecruiters.rows(data, "Acme")] == ["Berlin, Germany",