Skip to content

Dianel555/DSkills / skills/literature-searcher

literature-searcher

Verified

Search CrossRef, OpenAlex, PubMed, Semantic Scholar, and optional Scopus; deduplicate results, download open-access PDFs by DOI, classify papers, monitor new results, and analyze coverage. Use when asked to search literature, monitor a topic, download an open-access paper, classify papers, or analyze literature gaps.

tests/test_retry_budget.py

View on GitHub
import math
import urllib.error
import urllib.request

import pytest

from literature_searcher import semantic_scholar_searcher as semantic


@pytest.mark.parametrize("header", ["999999999", "NaN", "inf", "-50", "Wed, 01 Jan 2099 00:00:00 GMT"])
def test_retry_after_delay_is_finite_and_bounded(monkeypatch, header):
    sleeps, calls = [], []
    def fail(req, timeout):
        calls.append(1)
        raise urllib.error.HTTPError(req.full_url, 429, "limited", {"Retry-After": header}, None)
    monkeypatch.setattr(semantic.urllib.request, "urlopen", fail)
    monkeypatch.setattr(semantic.time, "sleep", sleeps.append)
    request = urllib.request.Request("https://example.invalid")
    assert semantic.SemanticScholarSearcher._request_with_retry(request, max_attempts=3) is None
    assert len(calls) == 3 and len(sleeps) == 2
    assert all(math.isfinite(s) and 0 <= s <= 30 for s in sleeps)
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 323kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 323kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 323kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall