import tempfile import unittest from unittest.mock import patch from paper_atlas.collectors.vision import collect_index, decode_html, discover, index_entries, parse_paper class VisionTests(unittest.TestCase): def entry(self): return {'url':'https://www.ecva.net/papers/eccv_2024/papers_ECCV/html/1_ECCV_2024_paper.php','index_title':'Paper','index_authors':'Jane Doe*, John Smith','doi':'10.1007/example_1'} def test_ecva_doi_belongs_to_its_own_title_entry(self): html='
First paper
Jane Doe*, John Smith
DOI
Second paper
Other Author
DOI
' entries,count=index_entries(html,'https://www.ecva.net/papers.php') self.assertEqual(count,2) self.assertEqual([e['doi'] for e in entries],['10.1007/example_1','10.1007/example_2']) html='
Paper
Abstract citing another paper and a reference.
' row=parse_paper(html,entries[0],'ecva','ECCV',2024,'main','https://www.ecva.net/papers.php') self.assertEqual(row['identifiers'],{'doi':'10.1007/example_1'}) self.assertEqual(row['authors'],['Jane Doe','John Smith']) def test_cvf_meta_authors_and_missing_abstract_never_capture_footer(self): html='
Do not include the proceedings citation

Copyright footer

' entry=dict(self.entry(),doi=None) row=parse_paper(html,entry,'cvf','CVPR',2013,'main','https://openaccess.thecvf.com/CVPR2013') self.assertEqual(row['authors'],['Jane Doe']) self.assertIsNone(row['abstract']) self.assertEqual(row['title'],'A vision paper') def test_conflicting_self_doi_is_rejected(self): html='' with self.assertRaisesRegex(ValueError,'DOI differs'): parse_paper(html,self.entry(),'ecva','ECCV',2024,'main','https://www.ecva.net/papers.php') def test_legacy_ecva_author_formats_do_not_become_extra_people(self): entry=dict(self.entry(),index_authors='Doe, Jane and Smith, John') page='
Paper
Jane Doe, John Smith; The European Conference on Computer Vision (ECCV), 2018, pp. 1-12
' row=parse_paper(page,entry,'ecva','ECCV',2018,'main','https://www.ecva.net/papers.php') self.assertEqual(row['authors'],['Jane Doe','John Smith']) row=parse_paper('
Paper
',entry,'ecva','ECCV',2018,'main','https://www.ecva.net/papers.php') self.assertEqual(row['authors'],['Jane Doe','John Smith']) def test_cvpr_day_one_is_replaced_by_explicit_all_papers_index(self): root='https://openaccess.thecvf.com/CVPR2026';all_url=root+'?day=all' first='https://openaccess.thecvf.com/content/CVPR2026/html/First_CVPR_2026_paper.html' second='https://openaccess.thecvf.com/content/CVPR2026/html/Second_CVPR_2026_paper.html' def item(url):return f'
Paper
Jane Doe, John Smith
[pdf]
' pages={root:f'All papers
{item(first)}
',all_url:f'
{item(first)}{item(second)}
',first:'
First paper
First abstract
',second:'
Second paper

Footer without an abstract

'} with tempfile.TemporaryDirectory() as tmp,patch('paper_atlas.collectors.vision.fetch',side_effect=lambda url,*a,**kw:pages[url].encode()) as fetch: manifest=collect_index('cvf',{'venue':'CVPR','year':2026,'track':'main','index_url':root},tmp,tmp) self.assertEqual(manifest['count'],2) self.assertEqual(manifest['list_url'],all_url) self.assertEqual(manifest['status'],'partial') self.assertEqual(manifest['missing_abstract_count'],1) self.assertEqual({call.args[0] for call in fetch.call_args_list},{root,all_url,first,second}) def test_discovery_keeps_findings_separate_and_excludes_workshops(self): html='MainFindingsMainLegacy mainWorkshopsWACV' with patch('paper_atlas.collectors.vision.fetch',return_value=html.encode()):indexes=discover('cvf','unused') self.assertEqual({(x['venue'],x['year'],x['track']) for x in indexes},{('CVPR',2013,'main'),('CVPR',2026,'main'),('CVPR',2026,'findings'),('ICCV',2025,'main')}) def test_unparsed_publication_link_does_not_silently_reduce_coverage(self): html='Other paper
Paper
' with self.assertRaisesRegex(ValueError,'outside parsed'): index_entries(html,'https://openaccess.thecvf.com/') def test_legacy_declared_encoding_is_respected(self): html='
André
' self.assertIn('André',decode_html(html.encode('iso-8859-1'))) if __name__=='__main__':unittest.main()