Integration check: wp-p-prep with wp-r1-raw and wp-r2-raw

Resolves tests/test_readers_shared.py, adds MATCH_MODE to the pinpoint,
recruitee and rippling tables, and removes table_word, country_if_single and
remote_word from plugins/readers/_shared.py with their tests and the Helpers
paragraph.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 11:31:31 +02:00
commit 55757c41e5
51 files changed
+445 -502

No files matched your search

+7 -6
View File
@@ -132,10 +132,10 @@ def test_workable_builds_the_job_url_and_reads_location_and_remote() -> None:
assert [r["source_id"] for r in rows] == ["6125026", "6125041"]
assert rows[0]["url"] == "https://apply.workable.com/huggingface/j/DB4D7C0EC8/"
assert rows[0]["location"] == "France"
assert rows[0]["remote"] is True
assert rows[0]["remote"] == "remote"
assert rows[0]["department"] == "Product"
assert rows[1]["location"] == "Berlin, Germany"
assert rows[1]["remote"] is False
assert rows[1]["remote"] == "hybrid"
assert rows[0]["description"] == "" # the list endpoint carries no text
assert rows[0]["salary_text"] == "" # Workable's list endpoint states no pay at all
@@ -173,8 +173,9 @@ def test_personio_builds_the_job_url_and_reads_cdata_description() -> None:
assert [r["source_id"] for r in rows] == ["6001", "6002", "6003"]
assert rows[0]["url"] == "https://acme.jobs.personio.de/job/6001"
assert rows[0]["description"] == "Grow our pipeline."
assert rows[0]["remote"] is True # "Remote - Germany"
assert rows[1]["remote"] is None # "Munich"
assert rows[0]["places"][0]["remote"] is True # "Remote - Germany"
assert rows[1]["places"][0]["remote"] is None # "Munich"
assert "remote" not in rows[0] # the feed states none
def test_personio_reads_salary_information_when_present() -> None:
@@ -291,9 +292,9 @@ def test_teamtailor_joins_the_distinct_locations_for_country_of() -> None:
assert country_of(rows[0]["location"]) == "SE"
def test_teamtailor_maps_remote_status_and_falls_back_to_role_for_department() -> None:
def test_teamtailor_hands_on_remote_status_and_falls_back_to_role_for_department() -> None:
rows = ats._parse_teamtailor(TEAMTAILOR, "kry")
assert [r["remote"] for r in rows] == ["hybrid", "remote", None] # none says nothing
assert [r["remote"] for r in rows] == ["hybrid", "fully", "none"] # prep maps them
assert rows[1]["title"] == "Läkare" # trimmed
assert rows[1]["department"] == "Software Development"
assert ats.classify(rows[1]["department"], "Sales Lead") == "sales"
+5 -5
View File
@@ -59,19 +59,19 @@ def test_the_locations_are_the_primary_and_the_secondary_ones() -> None:
assert rows[2]["location"] == "India"
def test_every_place_is_kept_with_its_work_mode_and_the_countrys_code() -> None:
def test_every_place_is_kept_with_its_work_mode() -> None:
rows = _rows()
assert [p["text"] for p in rows[1]["places"]] == [
"Malaysia", "Philippines", "Indonesia", "Thailand"]
assert [p["remote"] for p in rows[0]["places"]] == [False, False] # hybrid
assert [p["remote"] for p in rows[4]["places"]] == [True] # remote
assert [p["remote"] for p in rows[3]["places"]] == [None] # states none
# One country when the places share one, none over several.
assert [r["country"] for r in rows] == [None, None, "IN", "DE", "US"]
assert all("country" not in r for r in rows) # prep derives it from the places
def test_remote_follows_the_workplace_type_code() -> None:
assert [r["remote"] for r in _rows()] == ["hybrid", "hybrid", "onsite", None, "remote"]
def test_remote_is_the_workplace_type_code_as_given() -> None:
assert [r["remote"] for r in _rows()] == [
"ORA_HYBRID", "ORA_HYBRID", "ORA_ON_SITE", None, "ORA_REMOTE"]
def test_a_department_is_taken_where_a_tenant_fills_one() -> None:
+5 -19
View File
@@ -3,17 +3,14 @@ No network: the fixtures are saved feeds."""
from __future__ import annotations
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, personio # noqa: E402
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
@@ -37,23 +34,12 @@ def test_additional_offices_are_places_of_the_role_each_once() -> None:
assert [p["text"] for p in first["places"]] == ["Remote - Germany", "Berlin", "Hamburg"]
assert [p["remote"] for p in first["places"]] == [True, None, None]
assert first["location"] == "Remote - Germany; Berlin; Hamburg"
assert first["remote"] is True # one of the places is remote
assert "remote" not in first # the feed states none
assert _rows()[1]["places"] == [{"text": "Munich", "remote": None}]
assert _rows()[1]["remote"] is None
def test_the_stated_level_and_employment_are_mapped() -> None:
def test_the_stated_level_and_employment_are_the_hosts_words() -> None:
rows = _rows()
assert [r["seniority"] for r in rows] == ["junior", "exec", "intern"]
# permanent + full-time; permanent + full-time; working student wins over part-time
assert [r["employment"] for r in rows] == ["full_time", "full_time", "internship"]
def test_the_table_speaks_the_apps_vocabulary_and_a_new_word_is_logged(
caplog: pytest.LogCaptureFixture) -> None:
assert {v for v in personio._SENIORITY.values() if v} <= set(SENIORITIES)
with caplog.at_level(logging.DEBUG, logger=personio.__name__):
assert personio._seniority("wizard") is None
assert personio._seniority("experienced") is None # known, names no level
assert personio._seniority("") is None
assert [r.getMessage() for r in caplog.records] == ["personio: unknown seniority 'wizard'"]
assert [r["seniority"] for r in rows] == ["entry-level", "executive", "student"]
# permanent + full-time gives the schedule; a working student is the contract's word
assert [r["employment"] for r in rows] == ["full-time", "full-time", "working_student"]
+1 -1
View File
@@ -226,7 +226,7 @@ def test_detail_falls_back_to_the_page_state_where_there_is_no_job_posting() ->
got = phenom.detail(_get_of("phenom-detail-3.html", []), SLUG, row)
assert got["description"].startswith("Craft: Games Design & Production Job Description:")
assert "<" not in got["description"] and "&amp;" not in got["description"]
assert got["remote"] == "onsite"
assert got["remote"] == "On-site"
assert "posted" not in got and set(got) <= set(ats.DETAIL_FIELDS)
+2 -5
View File
@@ -161,9 +161,6 @@ def test_a_role_has_its_one_place_with_the_work_mode_of_the_role() -> None:
assert rows[0]["location"] == "Bucharest"
def test_employment_is_read_from_the_type_and_an_unknown_one_is_left() -> None:
def test_employment_is_the_hosts_type_as_given() -> None:
rows = pinpoint.parse((FIXTURES / "pinpoint.json").read_bytes(), "xeneta")
assert [r["employment"] for r in rows] == ["full_time", "temporary"]
assert pinpoint._employment("permanent_part_time") == "part_time"
assert pinpoint._employment("internship") == "internship"
assert pinpoint._employment("something_new") is None
assert [r["employment"] for r in rows] == ["permanent_full_time", "fixed_term_full_time"]
+9 -25
View File
@@ -4,17 +4,14 @@ bunq's board, read on 2026-09-30."""
from __future__ import annotations
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, recruitee # noqa: E402
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
@@ -27,19 +24,18 @@ def _rows() -> list[dict]:
def test_the_declaration_says_what_the_feed_gives() -> None:
reads = recruitee.READS
assert (reads.listing, reads.places, reads.text) == ("whole", "many", "listing")
assert reads.fields.posted == "trusted" and reads.fields.country == "stated"
assert reads.fields.posted == "trusted" and reads.fields.country == "none"
assert reads.robots.startswith("api: no robots.txt check needed")
assert recruitee.feed_url("acme", Ask()) == "https://acme.recruitee.com/api/offers/"
def test_every_location_is_a_place_and_the_country_is_stated_when_they_share_one() -> None:
def test_every_location_is_a_place_and_no_country_is_stated() -> None:
first, _remote, berlin = _rows()
assert [p["text"] for p in first["places"]] == [
"Amsterdam, Noord-Holland, Netherlands", "Sofia, Bulgaria"]
assert first["location"] == "Amsterdam, Noord-Holland, Netherlands; Sofia, Bulgaria"
assert first["country"] is None # NL and BG
assert "country" not in first # prep derives it from the places
assert berlin["places"] == [{"text": "Berlin, Germany", "remote": None}]
assert berlin["country"] == "DE"
def test_remote_job_is_not_a_place() -> None:
@@ -48,28 +44,16 @@ def test_remote_job_is_not_a_place() -> None:
assert remote["location"] == "Remote"
offer = {"id": 1, "title": "T", "careers_url": "https://a.example/o/t", "location": "Remote job",
"remote": False}
assert recruitee._places(offer) == ([], set())
assert recruitee._places(offer) == []
def test_an_offer_without_a_locations_list_falls_back_to_its_location() -> None:
offer = {"location": "Lisbon, Portugal", "country_code": "pt"}
assert recruitee._places(offer) == ([{"text": "Lisbon, Portugal", "remote": None}], {"PT"})
assert recruitee._places(offer) == [{"text": "Lisbon, Portugal", "remote": None}]
def test_the_stated_level_and_employment_are_mapped() -> None:
def test_the_stated_level_and_employment_are_the_hosts_codes() -> None:
rows = _rows()
assert [r["seniority"] for r in rows] == [None, "junior", "intern"]
assert [r["employment"] for r in rows] == ["full_time", "part_time", "internship"]
assert recruitee._employment("fulltime_fixed_term") == "temporary"
assert recruitee._employment("freelance") == "contract"
def test_the_table_speaks_the_apps_vocabulary_and_a_new_word_is_logged(
caplog: pytest.LogCaptureFixture) -> None:
assert {v for v in recruitee._SENIORITY.values() if v} <= set(SENIORITIES)
with caplog.at_level(logging.DEBUG, logger=recruitee.__name__):
assert recruitee._seniority("senior_level") is None
assert recruitee._employment("odd_job") is None
assert [r.getMessage() for r in caplog.records] == [
"recruitee: unknown experience_code 'senior_level'",
"recruitee: unknown employment_type_code 'odd_job'"]
assert [r["seniority"] for r in rows] == ["experienced", "entry_level", "student_school"]
assert [r["employment"] for r in rows] == [
"fulltime_permanent", "parttime_permanent", "internship"]
+10 -14
View File
@@ -41,21 +41,18 @@ def test_rows_merge_one_entry_per_place_into_one_role() -> None:
assert first["description"] == "" and first["salary_text"] == "" and first["posted"] is None
def test_remote_is_true_only_when_every_place_is_a_remote_one() -> None:
def test_a_remote_place_is_flagged_and_the_role_states_no_remote() -> None:
by_id = {r["source_id"][:8]: r for r in rippling.parse(BOARD, "rippling")}
assert by_id["46b4af52"]["remote"] is True and by_id["19ae5b34"]["remote"] is True
assert by_id["75ad50c6"]["remote"] is None # an office label says nothing either way
mixed = json.dumps([
{"uuid": "abcdefgh-1", "name": "A", "workLocation": {"label": "Remote (Germany)"}},
{"uuid": "abcdefgh-1", "name": "A", "workLocation": {"label": "Berlin"}}]).encode()
assert rippling.parse(mixed, "x")[0]["remote"] is None
assert [p["remote"] for p in by_id["46b4af52"]["places"]] == [True]
assert [p["remote"] for p in by_id["75ad50c6"]["places"]] == [None] # an office label
assert all("remote" not in r for r in by_id.values()) # prep derives it from the places
def test_prisma_board_reads_two_roles() -> None:
rows = rippling.parse(PRISMA, "prisma-careers")
assert [(r["title"], r["department"], r["location"], r["remote"]) for r in rows] == [
("General Applications: Engineering", "Engineering", "Remote (Germany)", True),
("General Applications: Product", "Product", "Remote (Germany)", True)]
assert [(r["title"], r["department"], r["location"]) for r in rows] == [
("General Applications: Engineering", "Engineering", "Remote (Germany)"),
("General Applications: Product", "Product", "Remote (Germany)")]
def test_an_empty_board_is_no_roles_and_an_error_answer_is_not_a_board() -> None:
@@ -92,7 +89,7 @@ def test_detail_reads_description_places_date_and_a_single_yearly_range() -> Non
assert "<" not in found["description"]
assert found["location"] == "San Francisco, CA; Seattle, WA; New York, NY"
assert [p["text"] for p in found["places"]] == ["San Francisco, CA", "Seattle, WA", "New York, NY"]
assert found["employment"] == "full_time" # employmentType.label SALARIED_FT
assert found["employment"] == "SALARIED_FT" # employmentType.label
assert found["posted"] is not None and found["posted"].isoformat() == \
"2025-04-07T12:29:19.348000-07:00"
assert (found["salary_min"], found["salary_max"], found["currency"]) == (216000, 378000, "USD")
@@ -203,13 +200,12 @@ def test_discovery_finds_the_board_slug() -> None:
("rippling", "prisma-careers"), ("rippling", "Acme"), ("rippling", "beta")]
def test_a_role_at_several_places_keeps_each_once_and_is_remote_only_if_all_are() -> None:
def test_a_role_at_several_places_keeps_each_once() -> None:
rows = {r["source_id"]: r for r in rippling.parse(BOARD, "rippling")}
director = rows[DIRECTOR]
assert [p["text"] for p in director["places"]] == [
"San Francisco, CA", "Seattle, WA", "New York, NY"]
assert director["location"] == "San Francisco, CA; Seattle, WA; New York, NY"
assert director["remote"] is None
remote = next(r for r in rows.values() if r["places"] == [
{"text": "Remote (United States)", "remote": True}])
assert remote["remote"] is True
assert remote["places"][0]["remote"] is True
+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",
+3 -13
View File
@@ -315,7 +315,7 @@ def _detail(name: str, url: str = "https://careers.vestas.com/job/x/1431772533/"
return successfactors.detail(get, "careers.vestas.com", {"url": url}) # type: ignore[arg-type]
def test_detail_reads_the_description_the_date_and_the_country_code_of_an_address() -> None:
def test_detail_reads_the_description_the_date_and_the_places_of_an_address() -> None:
got = _detail("successfactors-job.html")
assert got["description"].startswith("Senior Management | Full-Time | Commercial Are you")
assert "<" not in got["description"]
@@ -324,7 +324,7 @@ def test_detail_reads_the_description_the_date_and_the_country_code_of_an_addres
# The locality and the country's name; the region is cut to "Seou" by the site.
assert got["location"] == "Seoul, South Korea"
assert got["places"] == [{"text": "Seoul, South Korea", "remote": None}]
assert got["country"] == "KR"
assert "country" not in got # prep derives it from the places
def test_detail_keeps_every_address_of_a_role_at_several_places() -> None:
@@ -333,15 +333,6 @@ def test_detail_keeps_every_address_of_a_role_at_several_places() -> None:
assert [p["text"] for p in got["places"]] == [
"Seoul, South Korea", "Busan, South Korea", "Aarhus, Denmark"]
assert got["location"] == "Seoul, South Korea; Busan, South Korea; Aarhus, Denmark"
assert "country" not in got # KR and DK: no single country for the role
def test_detail_states_the_country_when_every_address_is_in_it() -> None:
text = _read("successfactors-places-detail.html").replace(
'content="Aarhus, DK, 8200"', 'content="Daegu, KR, 41200"')
got = successfactors.detail(lambda url, **kw: text.encode(), "careers.vestas.com",
{"url": "https://careers.vestas.com/job/x/1/"})
assert got["country"] == "KR"
def test_the_listing_place_is_the_roles_only_place_until_its_page_is_read() -> None:
@@ -351,11 +342,10 @@ def test_the_listing_place_is_the_roles_only_place_until_its_page_is_read() -> N
for r in rows)
def test_detail_reads_the_country_from_a_street_address() -> None:
def test_detail_reads_the_place_from_a_street_address() -> None:
"""Systematic and most other sites give one `streetAddress`, "City, CC, zip"."""
got = _detail("successfactors-job-street.html")
assert got["location"] == "Bern, Switzerland"
assert got["country"] == "CH"
assert got["posted"] == datetime(2026, 9, 28, 2, tzinfo=UTC)
assert got["description"].startswith("Senior Solution Engineer Defence")
+3 -11
View File
@@ -5,11 +5,9 @@ No network: the fixture has the shape of Hugging Face's board, read on
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:
@@ -49,21 +47,15 @@ def test_every_location_of_a_role_is_a_place_once() -> None:
assert [p["text"] for p in first["places"]] == ["Berlin, Germany", "Munich, Bavaria, Germany",
"Paris, France"]
assert first["location"] == "Berlin, Germany; Munich, Bavaria, Germany; Paris, France"
assert first["country"] is None # DE and FR
assert "country" not in first # prep derives it from the places
assert [p["remote"] for p in first["places"]] == [False] * 3
assert remote["places"] == [{"text": "France", "remote": True}]
assert remote["country"] == "FR"
# A list-less answer (the older shape) still gives its one place.
assert oslo["places"] == [{"text": "Oslo, Norway", "remote": False}]
assert oslo["country"] == "NO"
def test_the_stated_hours_are_mapped_and_an_unknown_type_is_logged(
caplog: pytest.LogCaptureFixture) -> None:
with caplog.at_level(logging.DEBUG, logger=workable.__name__):
rows = _rows()
assert [r["employment"] for r in rows] == ["full_time", "part_time", None]
assert [r.getMessage() for r in caplog.records] == ["workable: unknown type 'volunteer'"]
def test_the_stated_hours_are_the_hosts_word() -> None:
assert [r["employment"] for r in _rows()] == ["full", "part", "volunteer"]
def test_the_shape_of_a_real_list_answer_is_read() -> None:
+10 -11
View File
@@ -54,8 +54,8 @@ def test_rows_read_the_listing_of_a_tenant_that_sends_remote_type() -> None:
"Associate-Solutions-Architect_R35358")
assert first["posted"] == TODAY
assert first["description"] == "" and first["department"] == "" and first["salary_text"] == ""
# "Fully Flexible" is Zendesk's word for remote.
assert [r["remote"] for r in rows] == ["remote", "onsite", "hybrid", "remote", "hybrid"]
# The host's own words, "Fully Flexible" among them; prep maps them.
assert [r["remote"] for r in rows] == ["Fully Flexible", "In Office", "Hybrid", "Fully Flexible", "Hybrid"]
def test_rows_of_a_tenant_without_remote_type_leave_remote_unknown() -> None:
@@ -80,7 +80,7 @@ def test_rows_of_a_site_called_jobs_state_the_requisition_id_and_no_date_past_30
assert rows[1]["places"] == [{"text": "Remote US TX", "remote": True}]
assert rows[2]["url"].startswith("https://redhat.wd5.myworkdayjobs.com/jobs/job/")
assert rows[3]["posted"] is None # "Posted 30+ Days Ago" says only that it is older
assert [r["remote"] for r in rows] == ["onsite", "remote", "remote", "hybrid"]
assert [r["remote"] for r in rows] == ["Onsite", "Remote", "Remote", "Hybrid"]
@pytest.mark.parametrize(("text", "expected"), [
@@ -275,13 +275,12 @@ def test_detail_reads_the_description_date_remote_and_place_of_the_role() -> Non
SLUG, row)
assert asked == [f"https://{HOST}/wday/cxs/zendesk/zendesk"
"/job/Remote-Mexico-City-Mexico/Associate-Solutions-Architect_R35358"]
assert set(got) == {"description", "location", "places", "posted", "remote", "country",
"employment"}
assert set(got) == {"description", "location", "places", "posted", "remote", "employment"}
assert got["posted"] == datetime(2026, 9, 29, tzinfo=UTC)
assert got["remote"] == "remote"
assert got["remote"] == "Fully Flexible"
assert got["location"] == "Remote, Mexico City, Mexico"
assert got["places"] == [{"text": "Remote, Mexico City, Mexico", "remote": True}]
assert (got["country"], got["employment"]) == ("MX", "full_time")
assert got["employment"] == "Full time" and "country" not in got
assert got["description"].startswith("Job Description") or len(got["description"]) > 200
assert "<" not in got["description"] and "&nbsp;" not in got["description"]
assert " " not in got["description"]
@@ -296,7 +295,7 @@ def test_detail_names_every_location_of_a_role_listed_as_several() -> None:
"/job/Remote-Italy/Telco-Cloud-Consultant_R-059566-2"]
assert got["location"] == "Remote Italy; Remote Spain"
assert [p["text"] for p in got["places"]] == ["Remote Italy", "Remote Spain"]
assert "country" not in got # the code belongs to the main location alone
assert "country" not in got
def _detail(**info: Any) -> bytes:
@@ -337,9 +336,9 @@ def test_a_country_dash_city_place_is_turned_round() -> None:
assert workday._place("12 Locations", None) is None
def test_detail_takes_no_word_for_remote_it_does_not_know() -> None:
def test_detail_hands_on_a_word_for_remote_it_does_not_know() -> None:
row = workday.rows(_load("workday.json"), SLUG)[0]
assert "remote" not in workday.detail(_get_of(_detail(remoteType="No"), []), SLUG, row)
assert workday.detail(_get_of(_detail(remoteType="No"), []), SLUG, row)["remote"] == "No"
def test_detail_refuses_a_row_that_is_not_a_role_of_the_board() -> None:
@@ -383,7 +382,7 @@ def test_detail_is_read_through_the_getter_ats_binds(
monkeypatch.setattr(ats, "_get", fake_get)
row = workday.rows(_load("workday.json"), SLUG)[0]
got = workday.detail(ats._getter(object(), "workday", SLUG), SLUG, row) # type: ignore[arg-type]
assert got["remote"] == "remote"
assert got["remote"] == "Fully Flexible"
assert seen[0][:2] == ("workday", SLUG)
+12
View File
@@ -0,0 +1,12 @@
"""Oracle's word tables for prep: the host's codes, and what they mean."""
from __future__ import annotations
import importlib
oracle = importlib.import_module("app.prep.hosts.oracle")
def test_workplace_type_codes_read() -> None:
assert oracle.REMOTE == {"ora_remote": "remote", "ora_hybrid": "hybrid",
"ora_on_site": "onsite"}
+22
View File
@@ -0,0 +1,22 @@
"""Personio's word tables for prep: the feed's own words, and what they mean."""
from __future__ import annotations
import importlib
personio = importlib.import_module("app.prep.hosts.personio")
def test_seniority_words_read() -> None:
seniority = personio.SENIORITY
assert [seniority[w] for w in ("entry-level", "executive", "student")] == [
"junior", "exec", "intern"]
assert seniority["experienced"] == "" # known, names no level
assert "wizard" not in seniority
def test_employment_words_read_from_the_contract_or_the_schedule() -> None:
employment = personio.EMPLOYMENT
assert employment["working_student"] == "internship" and employment["freelance"] == "contract"
assert employment["permanent"] == ""
assert employment["full-time"] == "full_time" and employment["part-time"] == "part_time"
+12
View File
@@ -0,0 +1,12 @@
"""Phenom's word table for prep: the words a page's `checkRemote` says."""
from __future__ import annotations
import importlib
phenom = importlib.import_module("app.prep.hosts.phenom")
def test_check_remote_words_read() -> None:
assert phenom.REMOTE["on-site"] == "onsite" # King's pages
assert phenom.REMOTE["remote"] == "remote" and phenom.REMOTE["hybrid"] == "hybrid"
+24
View File
@@ -0,0 +1,24 @@
"""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]
+27
View File
@@ -0,0 +1,27 @@
"""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]
+19
View File
@@ -0,0 +1,19 @@
"""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]
+22
View File
@@ -0,0 +1,22 @@
"""SmartRecruiters' word tables for prep: the host's ids, and what they mean."""
from __future__ import annotations
import importlib
smartrecruiters = importlib.import_module("app.prep.hosts.smartrecruiters")
def test_experience_levels_read() -> None:
seniority = smartrecruiters.SENIORITY
assert [seniority[w] for w in ("internship", "entry_level", "director", "executive")] == [
"intern", "junior", "director", "exec"]
# Known, and naming no level.
assert [seniority[w] for w in ("associate", "mid_senior_level", "not_applicable")] == [""] * 3
assert "guru" not in seniority
def test_employment_types_read() -> None:
employment = smartrecruiters.EMPLOYMENT
assert employment["intern"] == "internship" and employment["permanent"] == ""
assert employment["full_time"] == "full_time" and employment["part_time"] == "part_time"
+14
View File
@@ -0,0 +1,14 @@
"""Teamtailor's word table for prep: the feed's `remoteStatus`."""
from __future__ import annotations
import importlib
teamtailor = importlib.import_module("app.prep.hosts.teamtailor")
def test_remote_status_words_read() -> None:
remote = teamtailor.REMOTE
assert [remote[w] for w in ("fully", "hybrid", "onsite")] == ["remote", "hybrid", "onsite"]
# Known, and saying nothing about where the role is worked.
assert remote["none"] == "" and remote["temporary"] == ""
+18
View File
@@ -0,0 +1,18 @@
"""Workable's word tables for prep: the host's own words, lowercased, and what they mean."""
from __future__ import annotations
import importlib
workable = importlib.import_module("app.prep.hosts.workable")
def test_workplace_words_read() -> None:
assert workable.REMOTE == {"remote": "remote", "hybrid": "hybrid", "on_site": "onsite"}
def test_type_words_read() -> None:
assert workable.EMPLOYMENT == {"full": "full_time", "part": "part_time",
"contract": "contract", "temporary": "temporary",
"internship": "internship"}
assert "volunteer" not in workable.EMPLOYMENT # an unknown word is prep's to report
+21
View File
@@ -0,0 +1,21 @@
"""Workday's word tables for prep: the host's own words, lowercased, and what they mean."""
from __future__ import annotations
import importlib
workday = importlib.import_module("app.prep.hosts.workday")
def test_remote_type_words_of_the_tenants_read() -> None:
remote = workday.REMOTE
# Zendesk's "Fully Flexible", Axis' "On-Site", Red Hat's "Onsite".
assert [remote[w] for w in ("remote", "fully flexible", "hybrid", "in office",
"on-site", "onsite")] == [
"remote", "remote", "hybrid", "onsite", "onsite", "onsite"]
assert "no" not in remote # a bare "No" says nothing
def test_time_type_words_read() -> None:
assert workday.EMPLOYMENT == {"full time": "full_time", "part time": "part_time"}
+1 -1
View File
@@ -46,7 +46,7 @@ def test_it_strips_highlights_keeps_the_excerpt_as_teaser_and_drops_predicted_pa
assert "description" not in first
assert first["company"] == "Acme GmbH"
assert first["places"] == [{"text": "Berlin, Deutschland", "remote": None}]
assert first["country"] == "DE" and first["remote"] == "remote"
assert first["country"] == "DE" and "remote" not in first
assert (first["salary_min"], first["salary_max"], first["currency"]) == (70000, 90000, "EUR")
assert (predicted["salary_min"], predicted["currency"]) == (None, None)
-9
View File
@@ -55,15 +55,6 @@ def test_it_reads_title_company_town_date_and_teaser() -> None:
assert (robot["title"], robot["company"]) == ("Marketing Content Creator", "Clerk.IO ApS")
def test_it_reads_hybrid_and_remote_from_the_town_line() -> None:
from plugins.readers._shared import remote_word
assert remote_word("Birkerød, Hybrid position") == "hybrid"
assert remote_word("Nordhavn og mulighed for hjemmearbejde") == "hybrid"
assert remote_word("Remote, Danmark") == "remote"
assert remote_word("Hedehusene") is None
def test_it_asks_for_the_query_the_area_and_the_page() -> None:
asked: list[str] = []
+2 -2
View File
@@ -61,12 +61,12 @@ def test_it_reads_title_company_date_and_the_full_text() -> None:
first, _no_town, remote = platsbanken.rows(decoded, "")
assert first["title"] == "Postdoctoral Researcher"
assert first["company"] == "European Spallation Source Eric"
assert first["country"] == "SE" and first["remote"] is None
assert first["country"] == "SE" and first["remote"] == "Arbete på plats"
assert first["url"] == "https://arbetsformedlingen.se/platsbanken/annonser/31457942"
assert first["posted"].date().isoformat() == "2026-09-09"
assert first["description"].startswith("The European Spallation Source")
assert "teaser" not in first
assert (remote["remote"], remote["company"], remote["posted"]) == ("remote", "", None)
assert (remote["remote"], remote["company"], remote["posted"]) == (None, "", None)
def test_it_sends_the_region_the_offset_and_no_region_for_all_of_sweden() -> None:
+8 -55
View File
@@ -1,8 +1,9 @@
"""The helpers the host modules share, and the one employment vocabulary."""
"""The helpers the host modules share, and the readers' copy of the one
employment vocabulary. The host word tables are prep's
(`app/prep/hosts`), held to the vocabularies by `tests/test_prep.py`."""
from __future__ import annotations
import logging
import sys
from pathlib import Path
@@ -11,38 +12,15 @@ if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from plugins import readers # noqa: E402
from plugins.readers import _shared # noqa: E402
from plugins.readers._shared import ( # noqa: E402
EMPLOYMENTS,
add_place,
country_if_single,
place,
remote_word,
table_word,
)
from plugins.readers._shared import EMPLOYMENTS, add_place, place # noqa: E402
#: The module-level names a reader keeps its employment words in.
_TABLES = ("_EMPLOYMENT", "_CONTRACT", "_SCHEDULE")
#: The readers of `ashby` to `lever` hand on the host's words; their tables
#: moved to `app/prep/hosts`.
_RAW = {"ashby", "bamboohr", "deel", "eightfold", "gem", "greenhouse", "hibob", "hrmanager",
"jibe", "jobylon", "lever"}
#: The module-level names a reader kept its word tables in.
_TABLES = ("_SENIORITY", "_EMPLOYMENT", "_CONTRACT", "_SCHEDULE", "_REMOTE")
def test_every_employment_table_maps_into_the_shared_vocabulary() -> None:
found = 0
def test_no_reader_keeps_a_word_table() -> None:
for name, module in readers.READERS.items():
assert not _RAW & {name} or not any(hasattr(module, t) for t in _TABLES), name
for table_name in _TABLES:
table = getattr(module, table_name, None)
if table is None:
continue
found += 1
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)
assert found >= 5
assert not [t for t in _TABLES if hasattr(module, t)], name
def test_the_vocabulary_is_the_documented_one() -> None:
@@ -64,28 +42,3 @@ def test_add_place_skips_empty_and_repeated_texts_and_keeps_order() -> None:
for text in ("Berlin", "", "Oslo", "Berlin"):
add_place(found, place(text))
assert [p["text"] for p in found] == ["Berlin", "Oslo"]
def test_table_word_maps_ignores_case_and_logs_only_unknown_words(caplog) -> None:
table = {"full-time": "full_time", "permanent": ""}
log = logging.getLogger("plugins.readers.acme")
with caplog.at_level(logging.DEBUG, logger=log.name):
assert table_word(table, " Full-Time ", log, "type") == "full_time"
assert table_word(table, "Permanent", log, "type") is None
assert table_word(table, None, log, "type") is None
assert not caplog.records
assert table_word(table, "Odd", log, "type") is None
assert [r.getMessage() for r in caplog.records] == ["acme: unknown type 'Odd'"]
def test_country_if_single_needs_exactly_one_code() -> None:
assert country_if_single({"DE"}) == "DE"
assert country_if_single({"DE", "SE"}) is None
assert country_if_single(set()) is None
def test_remote_word_reads_danish_swedish_and_english() -> None:
assert remote_word("Remote, Danmark") == "remote"
assert remote_word("Birkerød, Hybrid position") == "hybrid"
assert remote_word("Hedehusene") is None
assert _shared.remote_word is remote_word