Skip to content

Jules - fix test for latest mupdf master. #4612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions tests/gentle_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ def gentle_compare(w0, w1):
return True


def rms(a, b):
def rms(a, b, verbose=None, out_prefix=''):
'''
Returns RMS diff of raw bytes of two sequences.
'''
if verbose is True:
verbose = 100000
assert len(a) == len(b)
e = 0
for aa, bb in zip(a, b):
for i, (aa, bb) in enumerate(zip(a, b)):
if verbose and (i % verbose == 0):
print(f'{out_prefix}rms(): {i=} {e=} {aa=} {aa=}.')
e += (aa - bb) ** 2
rms = math.sqrt(e / len(a))
return rms
Expand All @@ -58,14 +62,9 @@ def pixmaps_rms(a, b, out_prefix=''):
a_mv = a.samples_mv
b_mv = b.samples_mv
assert len(a_mv) == len(b_mv)
e = 0
for i, (a_byte, b_byte) in enumerate(zip(a_mv, b_mv)):
if i % 100000 == 0:
print(f'{out_prefix}compare_pixmaps(): {i=} {e=} {a_byte=} {b_byte=}.')
e += (a_byte - b_byte) ** 2
rms = math.sqrt(e / len(a_mv))
print(f'{out_prefix}compare_pixmaps(): {e=} {rms=}.')
return rms
ret = rms(a_mv, b_mv, verbose=True, out_prefix=out_prefix)
print(f'{out_prefix}pixmaps_rms(): {ret=}.')
return ret


def pixmaps_diff(a, b, out_prefix=''):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ def test_2596():
pix1 = page.get_pixmap()
assert pix1.samples == pix0.samples
rebased = hasattr(pymupdf, 'mupdf')
if rebased:
if pymupdf.mupdf_version_tuple < (1, 27):
wt = pymupdf.TOOLS.mupdf_warnings()
assert wt == 'too many indirections (possible indirection cycle involving 24 0 R)'

Expand Down