mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Added tests
This commit is contained in:
parent
8828080868
commit
8045ecceef
BIN
Tests/images/expected_to_read.jp2
Normal file
BIN
Tests/images/expected_to_read.jp2
Normal file
Binary file not shown.
BIN
Tests/images/invalid_header_length.jp2
Normal file
BIN
Tests/images/invalid_header_length.jp2
Normal file
Binary file not shown.
BIN
Tests/images/not_enough_data.jp2
Normal file
BIN
Tests/images/not_enough_data.jp2
Normal file
Binary file not shown.
|
@ -4,7 +4,7 @@ from io import BytesIO
|
|||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFile, Jpeg2KImagePlugin, features
|
||||
from PIL import Image, ImageFile, Jpeg2KImagePlugin, UnidentifiedImageError, features
|
||||
|
||||
from .helper import (
|
||||
assert_image_equal,
|
||||
|
@ -159,6 +159,20 @@ def test_load_dpi():
|
|||
assert "dpi" not in im.info
|
||||
|
||||
|
||||
def test_header_errors():
|
||||
for path in (
|
||||
"Tests/images/invalid_header_length.jp2",
|
||||
"Tests/images/not_enough_data.jp2",
|
||||
):
|
||||
with pytest.raises(UnidentifiedImageError):
|
||||
with Image.open(path):
|
||||
pass
|
||||
|
||||
with pytest.raises(OSError):
|
||||
with Image.open("Tests/images/expected_to_read.jp2"):
|
||||
pass
|
||||
|
||||
|
||||
def test_layers_type(tmp_path):
|
||||
outfile = str(tmp_path / "temp_layers.jp2")
|
||||
for quality_layers in [[100, 50, 10], (100, 50, 10), None]:
|
||||
|
|
Loading…
Reference in New Issue
Block a user