Spaces:
Sleeping
Sleeping
File size: 654 Bytes
14c7fcf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from pathlib import Path
import pytest
from src.sources import normalize_arxiv_reference, resolve_source
def test_normalize_arxiv_id():
assert normalize_arxiv_reference("2501.17887") == "https://arxiv.org/pdf/2501.17887"
def test_normalize_arxiv_url():
assert normalize_arxiv_reference("https://arxiv.org/abs/2501.17887") == "https://arxiv.org/pdf/2501.17887"
def test_rejects_invalid_source():
with pytest.raises(ValueError):
resolve_source(None, "not a source")
def test_local_pdf(tmp_path: Path):
paper = tmp_path / "paper.pdf"
paper.write_bytes(b"%PDF-test")
assert resolve_source(paper, None) == str(paper)
|