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='
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='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