Inventory KDD 2026 programme cycles and withdrawal evidence
Metadata integrity checks / metadata (push) Successful in 8m7s
Metadata integrity checks / metadata (push) Successful in 8m7s
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
from hashlib import sha256
|
||||
import json
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
import unittest
|
||||
|
||||
from paper_atlas.cli import main
|
||||
from paper_atlas.collectors.kdd2026 import inventory
|
||||
|
||||
|
||||
def row(number, track, title='Paper title', authors='Name (Affiliation)'):
|
||||
return {'track': track, 'title': title, 'url': f'https://doi.org/10.1145/3770855.{number}', 'authors': authors}
|
||||
|
||||
|
||||
def snapshot(july, february):
|
||||
arrays = [
|
||||
f'<script>const cycle{n}Papers = {json.dumps(rows)}.map((paper, index) => paper);</script>'
|
||||
for n, rows in ((1, july), (2, february))
|
||||
]
|
||||
return '\n'.join(arrays).encode()
|
||||
|
||||
|
||||
class KDD2026Tests(unittest.TestCase):
|
||||
def test_cli_preserves_withdrawal_marker_and_identical_occurrences(self):
|
||||
retained = row(1, 'rtp')
|
||||
withdrawn = row(2, 'ads', '**WITHDRAWN/New SUBMISSION ID for Authorship Order Change 6/24/26 -- A revised work')
|
||||
incomplete = row(3, 'ais', authors='')
|
||||
raw = snapshot([retained, retained], [withdrawn, incomplete])
|
||||
with TemporaryDirectory() as directory:
|
||||
source = Path(directory) / 'snapshot.html'
|
||||
source.write_bytes(raw)
|
||||
out = source.with_suffix('.json')
|
||||
args = ['collect', 'kdd2026-program', '--snapshot', str(source), '--snapshot-sha256',
|
||||
sha256(raw).hexdigest(), '--out', str(out)]
|
||||
main(args)
|
||||
report = json.loads(out.read_bytes())
|
||||
with self.assertRaises(FileExistsError):
|
||||
main(args)
|
||||
self.assertEqual(report['source_rows_by_cycle_and_track'], {
|
||||
'july': {'research': 2}, 'february': {'applied_data_science': 1, 'ai_for_sciences': 1},
|
||||
})
|
||||
self.assertEqual(report['unique_dois'], 3)
|
||||
self.assertEqual(report['identical_repeat_rows'], 1)
|
||||
kept, replaced, sparse = report['records']
|
||||
self.assertEqual(kept['occurrences'], 2)
|
||||
self.assertEqual(replaced['programme_status'], 'withdrawn_with_replacement_mentioned')
|
||||
self.assertEqual(replaced['title'], 'A revised work')
|
||||
self.assertEqual(replaced['source_title'], withdrawn['title'])
|
||||
self.assertEqual(replaced['source_withdrawal_date_literal'], '6/24/26')
|
||||
self.assertNotIn('submission_id', replaced)
|
||||
self.assertFalse(sparse['authors_listed'])
|
||||
self.assertFalse(report['database_written'])
|
||||
|
||||
def test_conflicting_duplicate_and_unknown_status_fail(self):
|
||||
with self.assertRaisesRegex(ValueError, 'Conflicting duplicate DOI'):
|
||||
inventory(snapshot([row(1, 'rtp')], [row(1, 'ads')]))
|
||||
with self.assertRaisesRegex(ValueError, 'Unrecognized status'):
|
||||
inventory(snapshot([row(1, 'rtp')], [row(2, 'ads', '***WITHDRAWN -- Unknown format')]))
|
||||
|
||||
def test_hash_mismatch_leaves_no_output(self):
|
||||
with TemporaryDirectory() as directory:
|
||||
source = Path(directory) / 'snapshot.html'
|
||||
source.write_bytes(snapshot([row(1, 'rtp')], [row(2, 'ads')]))
|
||||
out = source.with_suffix('.json')
|
||||
with self.assertRaisesRegex(ValueError, 'snapshot hash or size'):
|
||||
main(['collect', 'kdd2026-program', '--snapshot', str(source), '--snapshot-sha256',
|
||||
'0' * 64, '--out', str(out)])
|
||||
self.assertFalse(out.exists())
|
||||
Reference in New Issue
Block a user