import unittest import json import tempfile from pathlib import Path from unittest.mock import patch from paper_atlas.collectors.proceedings import paper_links,parse_paper,main class ProceedingsTests(unittest.TestCase): def test_legacy_empty_class_attribute_does_not_break_a_paper(self): html='
Legacy formatting

Paper

Real abstract.

' row=parse_paper(html,'https://proceedings.neurips.cc/paper/2000/hash/a-Abstract.html','neurips',2000,'https://proceedings.neurips.cc/paper/2000') self.assertEqual(row['abstract'],'Real abstract.') def test_colm_nested_abstract_and_citation_authors(self): html='''

Abstract

Real abstract text.

Name Change Policy

Do not ingest footer.

''' row=parse_paper(html,'https://proceedings.colm.cc/paper_files/paper/2024/hash/a-Abstract-Conference.html','colm',2024,'https://proceedings.colm.cc/paper_files/paper/2024') self.assertEqual(row['abstract'],'Real abstract text.') self.assertEqual(row['authors'],['Jane Doe']) self.assertEqual(row['track'],'main') self.assertEqual(row['year'],2024) def test_declared_index_count_detects_truncation(self): html='

2 papers

Paper' with self.assertRaisesRegex(ValueError,'count differs'): paper_links(html,'https://proceedings.colm.cc/paper/2024') def test_missing_abstract_does_not_capture_footer(self): row=parse_paper('

Paper

Name Change Policy

Footer

','https://example.org/a','colm',2024,'https://example.org/') self.assertIsNone(row['abstract']) def test_paper_title_is_not_mistaken_for_index_paper_count(self): html='
  • Lessons from 1000 papers
  • ' self.assertEqual(len(paper_links(html,'https://datasets-benchmarks-proceedings.neurips.cc/paper/2021')),1) def test_neurips_track_and_legacy_abstract(self): html='

    Paper

    Datasets and Benchmarks Track

    Abstract

    Actual abstract.

    Name Change Policy

    Footer

    ' row=parse_paper(html,'https://proceedings.neurips.cc/a','neurips',2025,'https://proceedings.neurips.cc/') self.assertEqual(row['abstract'],'Actual abstract.') self.assertEqual(row['track'],'datasets_benchmarks') def test_focused_retry_preserves_other_index_status(self): root='https://proceedings.colm.cc/' url=root+'paper_files/paper/2024' other=root+'paper_files/paper/2025' paper=root+'paper_files/paper/2024/hash/a-Abstract-Conference.html' documents={root:f'20242025',url:f'

    1 papers

    Paper',paper:'

    Paper

    Abstract

    '} with tempfile.TemporaryDirectory() as tmp: status=Path(tmp)/'colm-index-status.json' status.write_text(json.dumps({other:{'status':'collected','files':[]}})) argv=['paper-atlas','--source','colm','--cache',tmp,'--out',tmp,'--year','2024'] with patch('sys.argv',argv),patch('paper_atlas.collectors.proceedings.fetch',side_effect=lambda u,*a,**kw:documents[u].encode()): main() result=json.loads(status.read_text()) self.assertEqual(result[other]['status'],'collected') self.assertEqual(result[url]['files'][0]['count'],1) def test_abstract_citations_are_not_used_as_self_identifiers(self): html='
    OpenReview

    Related work and another paper.

    ' row=parse_paper(html,'https://proceedings.colm.cc/paper','colm',2024,'https://proceedings.colm.cc/') self.assertEqual(row['identifiers'],{'openreview':'selfForum'}) if __name__=='__main__':unittest.main()