From a750e694033c9e4f189a8225af92c0a05c70d857 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Fri, 19 Sep 2025 14:48:08 +0200 Subject: [PATCH] Adapt pymupf test suite to upcoming MuPDF 1.26.9. --- tests/test_tables.py | 2 +- tests/test_textextract.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_tables.py b/tests/test_tables.py index dd691fab7..5fea09b73 100644 --- a/tests/test_tables.py +++ b/tests/test_tables.py @@ -184,7 +184,7 @@ def test_2979(): ), f"{pymupdf.TOOLS.set_small_glyph_heights()=}" wt = pymupdf.TOOLS.mupdf_warnings() - if pymupdf.mupdf_version_tuple >= (1, 27, 0): + if pymupdf.mupdf_version_tuple >= (1, 26, 9): assert ( wt == "bogus font ascent/descent values (3117 / -2463)\n... repeated 2 times...\nActualtext with no position. Text may be lost or mispositioned.\n... repeated 96 times..." diff --git a/tests/test_textextract.py b/tests/test_textextract.py index 154dd6f56..f6557bed6 100644 --- a/tests/test_textextract.py +++ b/tests/test_textextract.py @@ -339,7 +339,7 @@ def test_3594(): print(f' {line!r}') print('='*40) wt = pymupdf.TOOLS.mupdf_warnings() - if pymupdf.mupdf_version_tuple < (1, 27): + if pymupdf.mupdf_version_tuple < (1, 26, 9): assert not wt else: assert wt == 'Actualtext with no position. Text may be lost or mispositioned.\n... repeated 2 times...' @@ -892,7 +892,7 @@ def test_4546(): expected_mupdf_1_26_1 = b'JOB No.: Shipper (complete name and address) \xe5\x8f\x91\xe8\xb4\xa7\xe4\xba\xba(\xe5\x90\x8d\xe7\xa7\xb0\xe5\x8f\x8a\xe5\x9c\xb0\xe5\x9d\x80) Tel: Fax: \n \nS/O No. \xe6\x89\x98\xe8\xbf\x90\xe5\x8d\x95\xe5\x8f\xb7\xe7\xa0\x81 \nSINORICH TRANSPORT LIMITED \nSHIPPING ORDER \n\xe6\x89\x98\xe8\xbf\x90\xe5\x8d\x95 \n \xe5\xb8\x82\xe5\x9c\xba\xe9\x83\xa8: \n88570009 \n88577019 \n88'.decode() # This output is different from either of the two expected strings. - expected_mupdf_1_27_0 = b'JOB No.: \n \nS/O No. \xe6\x89\x98\xe8\xbf\x90\xe5\x8d\x95\xe5\x8f\xb7\xe7\xa0\x81 \nSINORICH TRANSPORT LIMITED \nSHIPPING ORDER \n\xe6\x89\x98\xe8\xbf\x90\xe5\x8d\x95 \n \xe5\xb8\x82\xe5\x9c\xba\xe9\x83\xa8: \n88570009 \n88577019 \n88572702 \n \xe6\x93\x8d\xe4\xbd\x9c\xe9\x83\xa8: \n88570008 \n88570004 \n \xe6\x96\x87\xe4\xbb\xb6\xe9\x83\xa8: \n88570003\n \nNotify Party(complete name and address, '.decode() + expected_mupdf_1_26_9 = b'JOB No.: \n \nS/O No. \xe6\x89\x98\xe8\xbf\x90\xe5\x8d\x95\xe5\x8f\xb7\xe7\xa0\x81 \nSINORICH TRANSPORT LIMITED \nSHIPPING ORDER \n\xe6\x89\x98\xe8\xbf\x90\xe5\x8d\x95 \n \xe5\xb8\x82\xe5\x9c\xba\xe9\x83\xa8: \n88570009 \n88577019 \n88572702 \n \xe6\x93\x8d\xe4\xbd\x9c\xe9\x83\xa8: \n88570008 \n88570004 \n \xe6\x96\x87\xe4\xbb\xb6\xe9\x83\xa8: \n88570003\n \nNotify Party(complete name and address, '.decode() print(f'expected_1_23_5\n{textwrap.indent(expected_1_23_5, " ")}') print(f'expected_mupdf_1_26_1\n{textwrap.indent(expected_mupdf_1_26_1, " ")}') @@ -903,8 +903,8 @@ def test_4546(): print(f'{text.encode()=}') wt = pymupdf.TOOLS.mupdf_warnings() - if pymupdf.mupdf_version_tuple >= (1, 27, 0): - assert text == expected_mupdf_1_27_0 + if pymupdf.mupdf_version_tuple >= (1, 26, 9): + assert text == expected_mupdf_1_26_9 assert wt == 'Actualtext with no position. Text may be lost or mispositioned.\n... repeated 120 times...' elif pymupdf.mupdf_version_tuple >= (1, 26, 1): assert text == expected_mupdf_1_26_1