Keep a discovered slug's case for a host with KEEP_CASE, and check only group 1 against the hosts' own path words
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9cb35ae785
commit
75a389d725
3 files changed
+45
-4
No files matched your search
@@ -4,6 +4,7 @@ site's pages are read."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import types
|
||||
from pathlib import Path
|
||||
|
||||
@@ -53,6 +54,33 @@ def test_boards_in_names_a_lever_eu_board_by_its_region() -> None:
|
||||
("lever", "whereby")]
|
||||
|
||||
|
||||
def test_boards_in_lowercases_a_slug_unless_the_host_keeps_its_case(
|
||||
monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""A Workday-shaped host with two groups and `KEEP_CASE`: the site keeps
|
||||
its case, and a site called `jobs` is a site, since only group 1 is
|
||||
checked against the hosts' own path words."""
|
||||
workday = re.compile(r"https?://([a-z0-9-]+\.wd\d+)\.myworkdayjobs\.com/"
|
||||
r"(?:[a-z]{2}-[A-Z]{2}/)?([A-Za-z0-9_-]+)", re.IGNORECASE)
|
||||
monkeypatch.setattr(mod, "HOSTS", (("workday", workday),
|
||||
*(h for h in mod.HOSTS if h[0] != "workday")))
|
||||
monkeypatch.setattr(mod, "_KEEP_CASE", frozenset({"workday"}))
|
||||
page = ('<a href="https://lego.wd103.myworkdayjobs.com/LEGO_External">a</a>'
|
||||
'<a href="https://redhat.wd5.myworkdayjobs.com/en-US/jobs">b</a>'
|
||||
'<a href="https://jobs.smartrecruiters.com/BoschGroup">c</a>'
|
||||
'<a href="https://jobs.eu.lever.co/TomTom">d</a>')
|
||||
assert [(h, s) for h, s, _ in boards_in(page)] == [
|
||||
("workday", "lego.wd103/LEGO_External"), ("workday", "redhat.wd5/jobs"),
|
||||
("smartrecruiters", "boschgroup"), ("lever", "eu/tomtom")]
|
||||
# A host's own path word in group 1 still names no board.
|
||||
assert boards_in('<a href="https://jobs.smartrecruiters.com/api">x</a>') == []
|
||||
|
||||
|
||||
def test_no_module_of_the_eight_keeps_its_case() -> None:
|
||||
"""SmartRecruiters and Ashby ignore case (checked live, 2026-09-29), so a
|
||||
slug from a page stays lowercased as it always was."""
|
||||
assert not mod._KEEP_CASE
|
||||
|
||||
|
||||
def test_a_host_that_gains_a_module_replaces_its_unreadable_pattern() -> None:
|
||||
"""Wave by wave, a host named here becomes readable by its module alone."""
|
||||
taleo = types.ModuleType("taleo")
|
||||
|
||||
Reference in new issue
Block a user