Merge branch 'wp-r1-raw' into scratch-p-integration

This commit is contained in:
Wolf committed 2026-09-30 11:28:38 +02:00
commit 45604e9316
37 files changed
+504 -171

No files matched your search

+4 -4
View File
@@ -25,14 +25,14 @@ def test_the_primary_and_every_secondary_location_are_places() -> None:
assert second["places"] == [{"text": "Dublin", "remote": True}]
def test_a_hybrid_role_is_not_remote_although_the_host_flags_it() -> None:
def test_remote_is_the_workplace_type_as_the_host_writes_it() -> None:
first, second = ashby.parse(BOARD, "acme")
assert first["remote"] == "hybrid" and second["remote"] == "remote"
assert first["remote"] == "Hybrid" and second["remote"] == "Remote"
def test_the_employment_type_is_mapped() -> None:
def test_the_employment_type_is_the_hosts_word() -> None:
first, second = ashby.parse(BOARD, "acme")
assert (first["employment"], second["employment"]) == ("full_time", "contract")
assert (first["employment"], second["employment"]) == ("FullTime", "Contract")
def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None:
+7 -7
View File
@@ -47,15 +47,15 @@ def test_a_listing_becomes_rows() -> None:
assert second["url"] == "https://configit.bamboohr.com/careers/37"
assert second["department"] == "Marketing" and rows[0]["department"] == ""
assert second["location"] == "København Ø"
assert second["remote"] == "hybrid"
assert second["remote"] == "2"
assert (second["posted"], second["description"], second["salary_text"]) == (None, "", "")
@pytest.mark.parametrize(("flag", "kind", "remote"), [
(True, "0", "remote"), (None, "0", "onsite"), (None, "1", "remote"), (None, "2", "hybrid"),
(None, None, None), (False, "7", None)])
(True, "0", True), (None, "0", "0"), (None, "1", "1"), (None, "2", "2"),
(None, None, None), (False, "7", "7")])
def test_remote_is_the_flag_then_the_location_type(
flag: bool | None, kind: str | None, remote: str | None) -> None:
flag: bool | None, kind: str | None, remote: bool | str | None) -> None:
body = json.loads(_read("bamboohr.json"))
body["result"][0] |= {"isRemote": flag, "locationType": kind}
assert bamboohr.parse(json.dumps(body).encode(), "configit")[0]["remote"] == remote
@@ -102,7 +102,7 @@ def test_detail_reads_the_text_the_date_and_the_country() -> None:
assert found["posted"] == datetime(2026, 9, 23, tzinfo=UTC)
assert found["location"] == "København Ø, Denmark"
assert found["places"] == [{"text": "København Ø, Denmark", "remote": None}]
assert found["remote"] == "hybrid"
assert found["remote"] == "2"
text = found["description"]
assert text.startswith("Our Global Marketing Team is looking for")
assert "Skills & Experience" in text and "&amp;" not in text and "<" not in text
@@ -144,11 +144,11 @@ def test_the_board_and_its_details_are_read_with_the_json_accept_on_the_detail()
def test_the_role_states_one_place_and_the_employment() -> None:
rows = bamboohr.parse(_read("bamboohr.json"), "configit")
assert rows[1]["places"] == [{"text": "København Ø", "remote": None}]
assert rows[1]["employment"] == "full_time"
assert rows[1]["employment"] == "Full-Time"
body = json.loads(_read("bamboohr.json"))
body["result"][0] |= {"employmentStatusLabel": "Seasonal", "location": {"city": None}}
first = bamboohr.parse(json.dumps(body).encode(), "configit")[0]
assert first["places"] == [] and "employment" not in first
assert first["places"] == [] and first["employment"] == "Seasonal"
def test_it_declares_what_it_reads() -> None:
+5 -5
View File
@@ -32,7 +32,7 @@ def test_rows_come_from_the_payload_with_descriptions_resolved() -> None:
assert first["url"] == ("https://jobs.deel.com/klarna/job-details/"
"21584046-56d5-44c4-8b18-7e15dc659827/overview")
assert first["location"] == "Stockholm" and first["department"] == "Engineering"
assert first["remote"] == "onsite"
assert first["remote"] == "ON_SITE"
assert first["description"].startswith("Klarna, briefly At Klarna")
assert "<" not in first["description"] and "$" not in first["description"][:3]
assert all(r["description"] for r in rows)
@@ -41,18 +41,18 @@ def test_rows_come_from_the_payload_with_descriptions_resolved() -> None:
"2026-09-07T12:33:38.484000+00:00"
def test_several_locations_are_joined_and_remote_uses_the_stores_words() -> None:
def test_several_locations_are_joined_and_remote_is_the_hosts_word() -> None:
rows = {r["source_id"][:8]: r for r in deel.parse(PAGE, "klarna")}
assert rows["a8be45ac"]["location"] == "Stockholm; London; Milan; Warsaw"
assert rows["f96bb9d4"]["remote"] == "remote"
assert rows["f96bb9d4"]["remote"] == "REMOTE"
assert rows["f96bb9d4"]["location"] == "Ohio"
# Every place is kept, in the host's order; the work arrangement is the
# places' remote flag.
assert rows["a8be45ac"]["places"] == [
{"text": name, "remote": False} for name in ("Stockholm", "London", "Milan", "Warsaw")]
assert rows["f96bb9d4"]["places"] == [{"text": "Ohio", "remote": True}]
assert rows["f96bb9d4"]["employment"] == "contract" # "Consultant"
assert rows["21584046"]["employment"] == "full_time"
assert rows["f96bb9d4"]["employment"] == "Consultant"
assert rows["21584046"]["employment"] == "Full-time"
def test_pay_is_only_text_since_the_period_is_not_stated() -> None:
+2 -2
View File
@@ -87,8 +87,8 @@ def test_a_page_becomes_rows() -> None:
@pytest.mark.parametrize(("option", "remote"), [
("onsite", "onsite"), ("hybrid", "hybrid"), ("remote", "remote"), (None, None), ("odd", None)])
def test_the_work_location_option_maps_to_the_remote_words(
("onsite", "onsite"), ("Hybrid", "Hybrid"), (None, None), ("odd", "odd"), (" ", None)])
def test_the_work_location_option_is_the_hosts_word(
option: str | None, remote: str | None) -> None:
assert eightfold.rows([_position(1) | {"workLocationOption": option}], SLUG)[0]["remote"] == remote
+6 -6
View File
@@ -55,7 +55,7 @@ def test_a_listing_becomes_rows() -> None:
assert first["source_id"] == "8080046002" # numeric, from a synced Greenhouse
assert first["title"] == "Staff AI Product Engineer (Prague/Brno/Remote EU)"
assert first["url"] == "https://jobs.gem.com/productboard/8080046002"
assert first["department"] == "Product Engineering" and first["remote"] == "hybrid"
assert first["department"] == "Product Engineering" and first["remote"] == "HYBRID"
assert first["location"] == "Prague"
assert (first["posted"], first["description"], first["salary_text"]) == (None, "", "")
assert backend["source_id"] == "am9icG9zdDqWC1V_RM7U6ORvTd1Iu64r" # opaque
@@ -64,16 +64,16 @@ def test_a_listing_becomes_rows() -> None:
assert backend["places"] == [{"text": "Prague", "remote": False},
{"text": "Remote Europe", "remote": True},
{"text": "Brno", "remote": False}]
assert first["employment"] == "full_time"
assert first["employment"] == "FULL_TIME"
assert len({r["source_id"] for r in rows}) == 11
@pytest.mark.parametrize(("kind", "flags", "remote"), [
("IN_OFFICE", [False], "onsite"), ("HYBRID", [True], "hybrid"), ("REMOTE", [False], "remote"),
(None, [True, True], "remote"), (None, [True, False], None), (None, [], None),
("SOMETHING_NEW", [False], None)])
("IN_OFFICE", [False], "IN_OFFICE"), ("HYBRID", [True], "HYBRID"), ("REMOTE", [False], "REMOTE"),
(None, [True, True], True), (None, [True, False], None), (None, [], None),
("SOMETHING_NEW", [False], "SOMETHING_NEW")])
def test_remote_is_the_location_type_then_the_locations(
kind: str | None, flags: list[bool], remote: str | None) -> None:
kind: str | None, flags: list[bool], remote: bool | str | None) -> None:
posting = {"extId": "1", "title": "Role", "job": {"locationType": kind},
"locations": [{"city": "X", "isRemote": f} for f in flags]}
assert gem.rows([posting], "acme")[0]["remote"] == remote
+4 -4
View File
@@ -51,7 +51,7 @@ def test_a_board_of_general_applications_reads_as_it_is() -> None:
rows = hibob.parse(DIXA, "dixa")
assert [(r["title"], r["location"], r["remote"]) for r in rows] == [
("Expression of interest", "Copenhagen, Denmark", "hybrid"),
("Expression of interest", "London, United Kingdom", "onsite")]
("Expression of interest", "London, United Kingdom", "on_site")]
assert rows[1]["description"].startswith("We're always excited")
@@ -153,10 +153,10 @@ def test_each_ad_names_one_site_and_the_host_lists_a_copy_per_site() -> None:
assert len({r["source_id"] for r in dixa}) == 2
def test_the_employment_type_is_mapped_and_a_permanent_one_is_left_unmapped() -> None:
def test_the_employment_type_is_the_hosts_word() -> None:
rows = hibob.parse(BOARD, "liquidia")
assert rows[0]["employment"] == "full_time" # "Regular Full Time"
assert "employment" not in hibob.parse(DIXA, "dixa")[0] # "Permanent"
assert rows[0]["employment"] == "Regular Full Time"
assert hibob.parse(DIXA, "dixa")[0]["employment"] == "Permanent"
def test_it_declares_copies_with_a_page_and_a_robots_decision() -> None:
+1 -1
View File
@@ -57,7 +57,7 @@ def test_a_page_becomes_rows() -> None:
"Manchester, United Kingdom"]
assert "country" not in several
assert first["places"] == [{"text": "Bucharest, Romania", "remote": None}]
assert (first["country"], first["employment"]) == ("RO", "full_time")
assert (first["country"], first["employment"]) == ("RO", "FULL_TIME")
assert all(r["description"] and "<" not in r["description"] and "&nbsp;" not in r["description"]
for r in rows)
+9 -14
View File
@@ -14,7 +14,6 @@ ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from app import models as app_models # noqa: E402
from app.jobs.discover import boards_in # noqa: E402
from plugins import ats, readers # noqa: E402
from plugins.readers import Ask, jobylon # noqa: E402
@@ -36,20 +35,20 @@ def test_rows_come_from_the_embeds_literal() -> None:
assert first["location"] == "Stockholm"
assert first["places"] == [{"text": "Stockholm", "remote": None}]
assert first["department"] == "Accounting & Finance" # `&` read as `&`
assert first["remote"] == "hybrid"
assert first["remote"] == "Hybrid"
assert first["description"] == "" and first["salary_text"] == ""
# A day, with no time of day: the embed says "Sept. 25, 2026".
assert first["posted"] is not None and first["posted"].isoformat() == \
"2026-09-25T00:00:00+00:00"
def test_places_department_and_remote_follow_the_embeds_words() -> None:
def test_places_department_and_remote_are_the_embeds_words() -> None:
rows = {r["source_id"]: r for r in jobylon.parse(BOARD, "3143")}
assert rows["384238"]["location"] == "Houston; Dallas; Atlanta"
assert [p["text"] for p in rows["384238"]["places"]] == ["Houston", "Dallas", "Atlanta"]
assert rows["384238"]["department"] == "" # "All functions" names none
assert rows["382124"]["remote"] == "remote"
assert rows["382860"]["remote"] == "onsite"
assert rows["382124"]["remote"] == "Remote"
assert rows["382860"]["remote"] == "On-site"
assert rows["380347"]["remote"] is None # a role with no workspace
@@ -130,18 +129,14 @@ def test_an_empty_board_is_no_roles() -> None:
assert jobylon.parse(EMPTY, "1056") == []
def test_the_experience_is_mapped_and_a_word_the_table_lacks_is_logged(
caplog: pytest.LogCaptureFixture) -> None:
caplog.set_level("DEBUG", logger="plugins.readers.jobylon")
def test_the_experience_and_the_employment_type_are_the_hosts_words() -> None:
rows = {r["source_id"]: r for r in jobylon.parse(BOARD, "3143")}
assert rows["384238"]["seniority"] == "mid" # "Mid level"
assert "seniority" not in rows["385191"] # "Experienced" says too little
assert "unknown experience 'Experienced'" in caplog.text
assert rows["385191"]["employment"] == "full_time"
assert all(r.get("seniority", "mid") in app_models.SENIORITIES for r in rows.values())
assert rows["384238"]["seniority"] == "Mid level"
assert rows["385191"]["seniority"] == "Experienced"
assert rows["385191"]["employment"] == "Full-time"
rows = {r["source_id"]: r for r in jobylon.parse(
(FIXTURES / "jobylon-places.html").read_bytes(), "3143")}
assert rows["502"]["seniority"] == "intern" and rows["502"]["employment"] == "internship"
assert rows["502"]["seniority"] == "Student" and rows["502"]["employment"] == "Internship"
def test_a_summary_is_the_teaser_unless_the_embed_says_none() -> None:
+2 -2
View File
@@ -28,9 +28,9 @@ def test_the_country_is_only_taken_for_a_role_at_one_place() -> None:
assert "country" not in several and one["country"] == "DE"
def test_the_commitment_is_mapped_and_a_permanent_one_is_left_unmapped() -> None:
def test_the_commitment_is_the_hosts_word() -> None:
several, one = lever.parse(BOARD, "acme")
assert several["employment"] == "full_time" and "employment" not in one
assert several["employment"] == "Full-time" and one["employment"] == "Permanent"
def test_it_declares_a_whole_listing_of_trusted_dates_and_no_robots_check() -> None:
+37
View File
@@ -0,0 +1,37 @@
"""The ashby words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.ashby")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['REMOTE', 'EMPLOYMENT'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('remote', 'remote'), ('hybrid', 'hybrid'), ('onsite', 'onsite')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('fulltime', 'full_time'), ('parttime', 'part_time'), ('intern', 'internship'), ('contract', 'contract'), ('temporary', 'temporary')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The bamboohr words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.bamboohr")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('0', 'onsite'), ('1', 'remote'), ('2', 'hybrid')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('part time', 'part_time'), ('intern', 'internship'), ('contractor', 'contract')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The deel words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.deel")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('on_site', 'onsite'), ('hybrid', 'hybrid'), ('remote', 'remote')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('consultant', 'contract'), ('internship', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+32
View File
@@ -0,0 +1,32 @@
"""The eightfold words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.eightfold")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('onsite', 'onsite'), ('on_site', 'onsite'), ('hybrid', 'hybrid'), ('remote', 'remote')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The gem words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.gem")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('in_office', 'onsite'), ('hybrid', 'hybrid'), ('remote', 'remote')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('full_time', 'full_time'), ('contractor', 'contract'), ('intern', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+37
View File
@@ -0,0 +1,37 @@
"""The hibob words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.hibob")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('remote', 'remote'), ('hybrid', 'hybrid'), ('on_site', 'onsite'), ('onsite', 'onsite')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
@pytest.mark.parametrize(("word", "value"), [('regular full time', 'full_time'), ('fixed term', 'temporary'), ('intern', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+32
View File
@@ -0,0 +1,32 @@
"""The jibe words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.jibe")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('full_time', 'full_time'), ('contractor', 'contract'), ('intern', 'internship')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+42
View File
@@ -0,0 +1,42 @@
"""The jobylon words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.jobylon")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['SENIORITY', 'EMPLOYMENT', 'REMOTE'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('mid level', 'mid'), ('student', 'intern'), ('entry level', 'junior'), ('executive', 'exec'), ('not applicable', '')])
def test_seniority_words(word: str, value: str) -> None:
assert hosts.SENIORITY[word] == value
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('consultant', 'contract'), ('summer job', 'temporary')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
@pytest.mark.parametrize(("word", "value"), [('remote', 'remote'), ('hybrid', 'hybrid'), ('on-site', 'onsite')])
def test_remote_words(word: str, value: str) -> None:
assert hosts.REMOTE[word] == value
+32
View File
@@ -0,0 +1,32 @@
"""The lever words, mapped to the app's vocabulary."""
from __future__ import annotations
import importlib
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 import models # noqa: E402
from plugins.readers._shared import EMPLOYMENTS # noqa: E402
hosts = importlib.import_module("app.prep.hosts.lever")
VOCABULARY = {"SENIORITY": models.SENIORITIES, "EMPLOYMENT": EMPLOYMENTS, "REMOTE": models.REMOTE}
@pytest.mark.parametrize("table", ['EMPLOYMENT'])
def test_the_table_keys_are_lowercase_and_the_values_in_the_vocabulary(table: str) -> None:
words = getattr(hosts, table)
assert all(key == key.strip().lower() for key in words)
assert set(words.values()) <= {*VOCABULARY[table], ""}
@pytest.mark.parametrize(("word", "value"), [('full-time', 'full_time'), ('fulltime', 'full_time'), ('intern', 'internship'), ('freelance', 'freelance')])
def test_employment_words(word: str, value: str) -> None:
assert hosts.EMPLOYMENT[word] == value
+7 -1
View File
@@ -24,10 +24,16 @@ from plugins.readers._shared import ( # 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"}
def test_every_employment_table_maps_into_the_shared_vocabulary() -> None:
found = 0
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:
@@ -36,7 +42,7 @@ 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)
assert found >= 15
assert found >= 5
def test_the_vocabulary_is_the_documented_one() -> None: