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
@@ -383,6 +383,23 @@ def test_search_source_stamps_complete_and_ids(monkeypatch: pytest.MonkeyPatch)
|
||||
assert source.state["search:ids:fake:cph"] == '["fake:h1"]'
|
||||
|
||||
|
||||
def test_a_search_drops_a_hit_without_a_title_and_stamps_the_count(
|
||||
monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""The search driver reads through the same listing code as a board: the
|
||||
runner drops the row the provider handed over without a title, and the
|
||||
read is still complete, by the distinct result ids."""
|
||||
_fake_provider(monkeypatch, ["h1", "h2"], complete=True)
|
||||
module = readers.PROVIDERS["fake"]
|
||||
handed = module.rows
|
||||
module.rows = lambda decoded, slug: [
|
||||
row | ({"title": ""} if row["source_id"] == "h2" else {}) for row in handed(decoded, slug)]
|
||||
source = SearchSource({"searches": [{"url": "fake:cph", "label": "Copenhagen",
|
||||
"params": {"q": "x"}}]})
|
||||
assert [i.source_id for i in source.fetch()] == ["fake:h1"]
|
||||
assert source.state["search:complete:fake:cph"] == "1"
|
||||
assert source.state["search:dropped:fake:cph"] == "1"
|
||||
|
||||
|
||||
def test_a_search_that_fails_is_skipped_and_stamps_nothing(
|
||||
monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.delenv("ADZUNA_APP_ID", raising=False)
|
||||
|
||||
Reference in new issue
Block a user