From 5fc3c9d6bb7ce6fa306f16c441aaecba1e0ab9f9 Mon Sep 17 00:00:00 2001 From: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> Date: Tue, 16 Jul 2024 14:24:57 +0300 Subject: [PATCH] adjusted tests for `1.18.0` libheif Signed-off-by: Alexander Piskun --- tests/basic_test.py | 11 ++++------- tests/read_test.py | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/basic_test.py b/tests/basic_test.py index 2970feea..2c2e893b 100644 --- a/tests/basic_test.py +++ b/tests/basic_test.py @@ -15,13 +15,10 @@ def test_libheif_info(): info = pillow_heif.libheif_info() for key in ("HEIF", "AVIF", "encoders", "decoders"): assert key in info - assert pillow_heif.libheif_version() in ( - "1.17.1", - "1.17.3", - "1.17.4", - "1.17.5", - "1.17.6", - ) + + version = pillow_heif.libheif_version() + valid_prefixes = ["1.17.", "1.18."] + assert any(version.startswith(prefix) for prefix in valid_prefixes) @pytest.mark.skipif(helpers.aom(), reason="Only when AVIF support missing.") diff --git a/tests/read_test.py b/tests/read_test.py index 6e91f447..7cdb76ac 100644 --- a/tests/read_test.py +++ b/tests/read_test.py @@ -99,8 +99,8 @@ def test_heif_corrupted_open(img_path): @pytest.mark.parametrize("img_path", dataset.CORRUPTED_DATASET) def test_pillow_corrupted_open(img_path): for input_type in [BytesIO(img_path.read_bytes()), img_path, builtins.open(img_path, "rb")]: - with pytest.raises(UnidentifiedImageError): - Image.open(input_type) + with pytest.raises((UnidentifiedImageError, ValueError)): + Image.open(input_type).load() def test_heif_image_order():