Files
paper-atlas/test_pmlr.py
T
codex-bot ad9967c1b2
Metadata integrity checks / metadata (push) Successful in 4s
Collect official COLM and NeurIPS abstracts with track-aware coverage
2026-11-06 12:04:18 +08:00

37 lines
1.6 KiB
Python

import unittest
import tempfile
from unittest.mock import patch
from collect_pmlr import load_metadata,venue_key,collect_volume
class MetadataTests(unittest.TestCase):
def test_legacy_binary_scalar_is_decoded_as_text(self):
self.assertEqual(load_metadata('title: !binary |\n SGVsbG8=\n')['title'],'Hello')
def test_trailing_empty_document_is_allowed(self):
self.assertEqual(load_metadata('---\nyear: 2024\n---\n'),{'year':2024})
def test_conflicting_documents_are_not_silently_combined(self):
with self.assertRaisesRegex(ValueError,'exactly one'):
load_metadata('year: 2024\n---\nyear: 2025\n')
def test_historical_conference_name_aliases(self):
self.assertEqual(venue_key('AISTATS 2010'),'AISTATS')
self.assertEqual(venue_key('AISTATS 2012'),'AISTATS')
self.assertEqual(venue_key('COLT 2012'),'COLT')
self.assertEqual(venue_key('ECML-PKDD'),'ECML-PKDD')
def test_missing_abstract_is_reported_as_partial_collection(self):
config=b'shortname: ICML\nyear: 2025\nbooktitle: ICML\n'
paper='---\nid: paper1\nlayout: inproceedings\ntitle: Paper\nabstract:\n---\n'
with tempfile.TemporaryDirectory() as tmp,patch('collect_pmlr.fetch',return_value=config),patch('collect_pmlr.metadata_texts',return_value=iter([('paper.md',paper)])):
result=collect_volume(999,tmp,tmp)
self.assertEqual(result['count'],1)
self.assertEqual(result['missing_abstract_count'],1)
self.assertEqual(result['status'],'partial')
if __name__=='__main__':
unittest.main()