Handle OPF metadata comments and record Highest Exam edition QA

This commit is contained in:
Kai Tan
2026-10-10 01:03:43 +08:00
parent 3e2093dba8
commit d12767a671
4 changed files with 52 additions and 2 deletions
+16
View File
@@ -182,3 +182,19 @@ def test_new_edition_uuid_keeps_obfuscated_font_readable_and_audited(tmp_path):
with zipfile.ZipFile(out) as z,zipfile.ZipFile(damaged,'w') as target:
for info in z.infolist(): target.writestr(info,b'broken' if info.filename==active else z.read(info.filename))
assert any('font_binding' in issue for issue in audit_edition(damaged)['issues'])
def test_metadata_comments_survive_localization(tmp_path):
source,cfg,image,review,_ = fixture(tmp_path)
commented=tmp_path/'commented.epub'
with zipfile.ZipFile(source) as z,zipfile.ZipFile(commented,'w') as target:
for info in z.infolist():
raw=z.read(info.filename)
if info.filename=='EPUB/package.opf':
raw=raw.replace(b'<metadata>',b'<metadata><!-- Publisher metadata comment -->')
target.writestr(info,raw)
out=tmp_path/'localized.epub'
localize(commented,out,cfg,'target_only',image,review)
assert audit_edition(out)['issues']==[]
with zipfile.ZipFile(out) as z:
assert b'<!-- Publisher metadata comment -->' in z.read('EPUB/package.opf')