|
|
|
@@ -37,6 +37,27 @@ class VisionTests(unittest.TestCase):
|
|
|
|
|
collect_index('cvf',{'venue':'CVPR','year':2018,'track':'main','index_url':root},tmp,tmp)
|
|
|
|
|
self.assertFalse(list(Path(tmp).glob('*.jsonl')))
|
|
|
|
|
|
|
|
|
|
def test_fragment_variants_share_one_all_papers_resource(self):
|
|
|
|
|
root,papers,entry=self.cvf_fixture();all_url=root+'?day=all'
|
|
|
|
|
pages={root:''.join(f'<a href="{all_url}{fragment}">All</a>' for fragment in ('','#','#papers')),
|
|
|
|
|
all_url:'<dl>'+entry(papers[0])+entry(papers[1])+'</dl>'}
|
|
|
|
|
pages.update({paper:'<div id="papertitle">Paper</div><div id="abstract">Abstract</div>' for paper in papers[:2]})
|
|
|
|
|
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':2018,'track':'main','index_url':root},tmp,tmp)
|
|
|
|
|
self.assertEqual(manifest['count'],2)
|
|
|
|
|
self.assertEqual(manifest['index_urls'],[all_url])
|
|
|
|
|
self.assertEqual([call.args[0] for call in fetch.call_args_list].count(all_url),1)
|
|
|
|
|
self.assertFalse(any('#' in call.args[0] for call in fetch.call_args_list))
|
|
|
|
|
|
|
|
|
|
def test_distinct_all_papers_queries_still_fail_before_publishing(self):
|
|
|
|
|
root,_,_=self.cvf_fixture();urls=[root+'?day=all',root+'?day=all&view=alternate']
|
|
|
|
|
html=''.join(f'<a href="{url}">All</a>' for url in urls).encode()
|
|
|
|
|
with tempfile.TemporaryDirectory() as tmp,patch('paper_atlas.collectors.vision.fetch',return_value=html) as fetch:
|
|
|
|
|
with self.assertRaisesRegex(ValueError,'Ambiguous all-papers index'):
|
|
|
|
|
collect_index('cvf',{'venue':'CVPR','year':2018,'track':'main','index_url':root},tmp,tmp)
|
|
|
|
|
self.assertEqual(fetch.call_count,1)
|
|
|
|
|
self.assertFalse(list(Path(tmp).glob('*.jsonl')))
|
|
|
|
|
|
|
|
|
|
def test_missing_abstract_page_keeps_official_index_metadata_and_marks_partial(self):
|
|
|
|
|
root,papers,entry=self.cvf_fixture();error=HTTPError(papers[0],404,'Not Found',{},io.BytesIO())
|
|
|
|
|
def fetch(url,*args,**kwargs):
|
|
|
|
|