Preserve Springer title literals across superscript formatting
Metadata integrity checks / metadata (push) Successful in 12m44s

This commit is contained in:
2026-11-18 19:25:00 +08:00
parent 48f8304517
commit bc01f90e70
3 changed files with 27 additions and 4 deletions
+14 -1
View File
@@ -6,7 +6,7 @@ import sqlite3
import tempfile
import unittest
from paper_atlas.collectors.eccv2026_publications import BOOK_TITLE, SOURCE, collect
from paper_atlas.collectors.eccv2026_publications import BOOK_TITLE, SOURCE, collect, publisher_row
from paper_atlas.db.store import Store
from paper_atlas.ingestion.records import ingest_file
@@ -114,6 +114,19 @@ class ECCV2026PublicationsTests(unittest.TestCase):
with self.assertRaises(FileExistsError):
collect(root / 'out', **source)
def test_numeric_superscript_wrappers_preserve_both_title_literals(self):
chapter = {'doi': FIRST_DOI, 'title': 'Example $$^2$$ : Formal title',
'authors': [], 'abstract': 'Published abstract.', 'authors_citation_raw': [],
'first_page': '1', 'last_page': '10'}
toc = {'title': r'Example \(^2\) : Formal title', 'book_doi': FIRST_BOOK, 'lncs_volume': 17001,
'evidence_url': 'https://link.springer.com/book/' + FIRST_BOOK, 'evidence_sha256': 'a' * 64}
evidence = {'observed_at': '2026-11-18T00:00:00Z'}
row = publisher_row(chapter, toc, evidence)
self.assertEqual(row['title'], chapter['title'])
self.assertEqual(row['metadata']['publisher_contents_evidence']['title_literal'], toc['title'])
with self.assertRaisesRegex(ValueError, 'title differs'):
publisher_row(chapter, {**toc, 'title': r'Example \(^3\) : Formal title'}, evidence)
def test_changed_contents_receipt_stops_before_output(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)