~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
"""Tests for URLClassifier._is_pdf_url method."""
from local_deep_research.content_fetcher.url_classifier import URLClassifier
class TestIsPdfUrl:
"""Tests for _is_pdf_url()."""
def test_pdf_extension(self):
assert URLClassifier._is_pdf_url("https://example.com/doc.pdf") is True
def test_pdf_extension_case_insensitive(self):
assert URLClassifier._is_pdf_url("https://example.com/doc.PDF") is True
def test_pdf_in_path(self):
assert (
URLClassifier._is_pdf_url("https://example.com/pdf/document")
is True
)
def test_html_url(self):
assert (
URLClassifier._is_pdf_url("https://example.com/page.html") is False
)
def test_no_extension(self):
assert (
URLClassifier._is_pdf_url("https://example.com/article/123")
is False
)
def test_arxiv_pdf_not_treated_as_generic_pdf(self):
"""arXiv PDFs should use specialized downloader, not generic PDF."""
assert (
URLClassifier._is_pdf_url("https://arxiv.org/pdf/2301.12345")
is False
)
def test_biorxiv_pdf_not_treated_as_generic_pdf(self):
assert (
URLClassifier._is_pdf_url(
"https://www.biorxiv.org/content/10.1101/2024.01.01.pdf"
)
is False
)
def test_medrxiv_pdf_not_treated_as_generic_pdf(self):
assert (
URLClassifier._is_pdf_url(
"https://www.medrxiv.org/content/10.1101/2024.01.01.pdf"
)
is False
)
def test_ncbi_pdf_not_treated_as_generic_pdf(self):
assert (
URLClassifier._is_pdf_url(
"https://ncbi.nlm.nih.gov/pmc/articles/PMC123/pdf/"
)
is False
)
def test_semanticscholar_not_treated_as_generic_pdf(self):
assert (
URLClassifier._is_pdf_url(
"https://pdfs.semanticscholar.org/abc.pdf"
)
is False
)
def test_generic_domain_pdf(self):
"""Non-academic domain PDFs should be treated as generic PDFs."""
assert (
URLClassifier._is_pdf_url("https://company.com/reports/annual.pdf")
is True
)
def test_pdf_with_query_params(self):
assert (
URLClassifier._is_pdf_url("https://example.com/doc.pdf?v=2") is True
)
def test_url_with_pdf_in_query_not_matched(self):
"""pdf in query string shouldn't trigger PDF detection."""
assert (
URLClassifier._is_pdf_url("https://example.com/viewer?file=doc.pdf")
is False
)