Pillow/Tests/test_jxl_leaks.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
561 B
Python
Raw Normal View History

2024-03-02 02:56:38 +03:00
from __future__ import annotations
from io import BytesIO
from PIL import Image
from .helper import PillowLeakTestCase, skip_unless_feature
2024-03-19 15:00:50 +03:00
TEST_FILE = "Tests/images/hopper.jxl"
2024-03-02 02:56:38 +03:00
2024-03-20 00:17:35 +03:00
@skip_unless_feature("jpegxl")
class TestJpegXlLeaks(PillowLeakTestCase):
2024-03-19 15:00:50 +03:00
mem_limit = 6 * 1024 # kb
iterations = 1000
2024-03-02 02:56:38 +03:00
def test_leak_load(self) -> None:
2024-03-19 15:00:50 +03:00
with open(TEST_FILE, "rb") as f:
2024-03-02 02:56:38 +03:00
im_data = f.read()
def core() -> None:
with Image.open(BytesIO(im_data)) as im:
im.load()
self._test_leak(core)