Skip to content

Commit

Permalink
PIL buffer test: relax copy assert to warning
Browse files Browse the repository at this point in the history
Our test suite should not fail if PIL improves in this regard,
esp. seeing as test suite failure inhibites new releases.
  • Loading branch information
mara004 committed Jun 18, 2023
1 parent 5f2288a commit 5739294
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests_old/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import math
import numpy
import warnings
import PIL.Image
import pytest
import pypdfium2 as pdfium
Expand Down Expand Up @@ -385,6 +386,7 @@ def test_pil_nocopy_where_possible(bitmap_format, rev_byteorder, is_referenced,

assert pil_image.getpixel((0, 0)) == pixel_a
bitmap.buffer[0] = val_b

if is_referenced:

# changes to the buffer are reflected in the image
Expand All @@ -396,4 +398,7 @@ def test_pil_nocopy_where_possible(bitmap_format, rev_byteorder, is_referenced,
assert bitmap.buffer[0] == val_a

else:
assert pil_image.getpixel((0, 0)) == pixel_a
if pil_image.getpixel((0, 0)) == pixel_b:
warnings.warn(f"PIL now references {bitmap.mode} mode bitmaps.")
else:
assert pil_image.getpixel((0, 0)) == pixel_a

0 comments on commit 5739294

Please sign in to comment.