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, adzuna # noqa: E402
|
||||
from plugins.readers import Ask, _runner, adzuna # noqa: E402
|
||||
|
||||
BODY = (ROOT / "tests" / "fixtures" / "search" / "adzuna.json").read_bytes()
|
||||
ASK = Ask(params={"q": "backend", "country": "de", "where": "Berlin",
|
||||
@@ -39,8 +39,9 @@ def test_it_declares_the_key_and_states_the_robots_finding() -> None:
|
||||
|
||||
|
||||
def test_it_strips_highlights_keeps_the_excerpt_as_teaser_and_drops_predicted_pay() -> None:
|
||||
first, predicted = _rows() # javascript: refused
|
||||
first, predicted, refused = _rows()
|
||||
assert [r["source_id"] for r in (first, predicted)] == ["4412345678", "4412345679"]
|
||||
assert refused["url"].startswith("javascript:") and not _runner.valid(refused)
|
||||
assert first["title"] == "Senior Backend Engineer (m/w/d) - Remote"
|
||||
assert first["teaser"] == "Build our backend services in Python & Go."
|
||||
assert "description" not in first
|
||||
@@ -89,3 +90,12 @@ def test_saved_params_need_a_known_country() -> None:
|
||||
"q": "x", "country": "gb"}
|
||||
with pytest.raises(ValueError, match="country"):
|
||||
adzuna.clean_params({"q": "x", "country": "dk"})
|
||||
|
||||
|
||||
def test_the_runner_drops_the_ad_without_a_web_link_and_counts_it() -> None:
|
||||
"""The reader hands the `javascript:` ad over; the runner drops it, and
|
||||
the read is complete, since all three result ids were read."""
|
||||
listing = _runner.read_listing(adzuna, "", lambda url, **kw: BODY, ASK,
|
||||
limits=_runner.Limits(page_delay=0))
|
||||
assert listing.ids == ["4412345678", "4412345679"]
|
||||
assert (listing.handed, listing.dropped, listing.complete) == (3, 1, True)
|
||||
Reference in new issue
Block a user