Let the runner drop and count a row without an id, a title or a link, as ADR Plugins 3.8 has it, in one place for whole, paged and search reads: the count is stamped per target, logged, named on the board's row, and over 10% of the rows fails the read; the 28 readers hand every listing over instead of skipping it
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
38c31c830b
commit
911dfe8584
58 files changed
+479
-203
No files matched your search
@@ -16,7 +16,7 @@ if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from plugins import readers # noqa: E402
|
||||
from plugins.readers import Ask, freehire # noqa: E402
|
||||
from plugins.readers import Ask, _runner, freehire # noqa: E402
|
||||
|
||||
BODY = (ROOT / "tests" / "fixtures" / "search" / "freehire-places.json").read_bytes()
|
||||
|
||||
@@ -119,14 +119,17 @@ def test_a_salary_of_another_period_is_a_line_and_no_figures() -> None:
|
||||
assert (year["salary_min"], year["salary_max"], year["currency"]) == (60000, None, "EUR")
|
||||
|
||||
|
||||
def test_it_refuses_a_hit_without_a_title_an_id_or_a_web_link() -> None:
|
||||
def test_a_hit_without_a_title_an_id_or_a_web_link_is_handed_to_the_runner() -> None:
|
||||
"""The reader hands every hit over; the runner keeps only the whole one."""
|
||||
hits = [{"public_slug": "a", "title": "A", "url": "javascript:alert(1)"},
|
||||
{"public_slug": "", "title": "B", "url": "https://x.example/b"},
|
||||
{"public_slug": "c", "title": " ", "url": "https://x.example/c"},
|
||||
{"public_slug": "d", "title": "D", "url": "https://x.example/d?utm_source=freehire.me"}]
|
||||
found = freehire.rows({"data": hits}, "")
|
||||
assert [row["source_id"] for row in found] == ["d"]
|
||||
assert found[0]["url"] == "https://x.example/d" and found[0]["places"] == []
|
||||
assert [row["source_id"] for row in found] == ["a", "", "c", "d"]
|
||||
kept = [row for row in found if _runner.valid(row)]
|
||||
assert [row["source_id"] for row in kept] == ["d"]
|
||||
assert kept[0]["url"] == "https://x.example/d" and kept[0]["places"] == []
|
||||
|
||||
|
||||
def test_a_title_and_a_company_have_their_entities_decoded() -> None:
|
||||
|
||||
Reference in new issue
Block a user