MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_3237

Function test_3237

tests/test_metadata.py:30–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29
30def test_3237():
31 filename = os.path.abspath(f'{__file__}/../../tests/resources/001003ED.pdf')
32 with pymupdf.open(filename) as doc:
33 # We need to explicitly encode in utf8 on windows.
34 metadata1 = doc.metadata
35 metadata1 = repr(metadata1).encode('utf8')
36 doc.set_metadata({})
37
38 metadata2 = doc.metadata
39 metadata2 = repr(metadata2).encode('utf8')
40 print(f'{metadata1=}')
41 print(f'{metadata2=}')
42 assert metadata1 == b'{\'format\': \'PDF 1.6\', \'title\': \'RUBRIK_Editorial_01-06.indd\', \'author\': \'Natalie Schaefer\', \'subject\': \'\', \'keywords\': \'\', \'creator\': \'\', \'producer\': \'Acrobat Distiller 7.0.5 (Windows)\', \'creationDate\': "D:20070113191400+01\'00\'", \'modDate\': "D:20070120104154+01\'00\'", \'trapped\': \'\', \'encryption\': None}'
43 assert metadata2 == b"{'format': 'PDF 1.6', 'title': '', 'author': '', 'subject': '', 'keywords': '', 'creator': '', 'producer': '', 'creationDate': '', 'modDate': '', 'trapped': '', 'encryption': None}"

Callers

nothing calls this directly

Calls 1

set_metadataMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…