import pytest from citer.identifiers import normalize_arxiv_identifier, normalize_doi def test_normalize_arxiv_variants(): assert normalize_arxiv_identifier("2106.01342v2") == "2106.01342" assert normalize_arxiv_identifier("https://arxiv.org/abs/2106.01342") == "2106.01342" assert normalize_arxiv_identifier("arXiv:hep-th/9901001") == "hep-th/9901001" def test_normalize_arxiv_invalid(): with pytest.raises(Exception): normalize_arxiv_identifier("not-an-id") def test_normalize_doi_variants(): assert normalize_doi("https://doi.org/10.1038/nphys1170") == "10.1038/nphys1170" assert normalize_doi("DOI:10.5555/12345678") == "10.5555/12345678" assert normalize_doi("10.1000/182") == "10.1000/182" def test_normalize_doi_invalid(): with pytest.raises(Exception): normalize_doi("not-a-doi")