diff --git a/sample-files b/sample-files index 65e2d2ca8..0c3b1d387 160000 --- a/sample-files +++ b/sample-files @@ -1 +1 @@ -Subproject commit 65e2d2ca8a137bfb1807b9991d5ca97f90365cc3 +Subproject commit 0c3b1d3879c5cd7d913b3d931fa33b37529d7346 diff --git a/tests/test_utils.py b/tests/test_utils.py index abb022db5..3ae80bddb 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -221,8 +221,8 @@ def test_read_block_backwards_exception(): def test_deprecation_bookmark(): @deprecation_bookmark(old_param="new_param") - def foo(old_param: int = 1, baz: int = 2) -> float: - return old_param * baz + def foo(old_param: int = 1, baz: int = 2) -> None: + pass with pytest.raises(DeprecationError) as exc: foo(old_param=12, new_param=13) diff --git a/tests/test_xmp.py b/tests/test_xmp.py index 50555b476..cfcf02111 100644 --- a/tests/test_xmp.py +++ b/tests/test_xmp.py @@ -15,6 +15,26 @@ TESTS_ROOT = Path(__file__).parent.resolve() PROJECT_ROOT = TESTS_ROOT.parent RESOURCE_ROOT = PROJECT_ROOT / "resources" +SAMPLE_ROOT = Path(PROJECT_ROOT) / "sample-files" + + +@pytest.mark.samples() +@pytest.mark.parametrize( + "src", + [ + (SAMPLE_ROOT / "020-xmp/output_with_metadata_pymupdf.pdf"), + ], +) +def test_read_xmp_metadata_samples(src): + reader = PdfReader(src) + xmp = reader.xmp_metadata + assert xmp + assert xmp.dc_contributor == [] + assert xmp.dc_creator == ["John Doe"] + assert xmp.dc_source == "Martin Thoma" # attribute node + assert xmp.dc_description == {"x-default": "This is a text"} + assert xmp.dc_date == [datetime(1990, 4, 28, 0, 0)] + assert xmp.dc_title == {"x-default": "Sample PDF with XMP Metadata"} @pytest.mark.parametrize(