mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
91664c9d8e
commit
1c9a84d760
|
@ -14,7 +14,7 @@ from typing import List
|
|||
import pytest
|
||||
from packaging.version import parse as parse_version
|
||||
|
||||
from PIL import Image, ImageMath, features, ImageChops
|
||||
from PIL import Image, ImageChops, ImageMath, features
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -24,7 +24,6 @@ if os.environ.get("SHOW_ERRORS"):
|
|||
# local img.show for errors.
|
||||
HAS_UPLOADER = True
|
||||
|
||||
|
||||
class test_image_results:
|
||||
@staticmethod
|
||||
def upload(a, b):
|
||||
|
@ -35,7 +34,6 @@ if os.environ.get("SHOW_ERRORS"):
|
|||
elif "GITHUB_ACTIONS" in os.environ:
|
||||
HAS_UPLOADER = True
|
||||
|
||||
|
||||
class test_image_results:
|
||||
@staticmethod
|
||||
def upload(a, b):
|
||||
|
@ -60,7 +58,7 @@ def concat_h(images: List[Image.Image]):
|
|||
for image in images[1:]:
|
||||
assert image.height == new_size[1]
|
||||
new_size = (new_size[0] + image.width, new_size[1])
|
||||
dst = Image.new('RGBA', new_size)
|
||||
dst = Image.new("RGBA", new_size)
|
||||
x_offset = 0
|
||||
for image in images:
|
||||
dst.paste(image, (x_offset, 0))
|
||||
|
@ -91,12 +89,12 @@ def assert_deep_equal(a, b, msg=None):
|
|||
def assert_image(im, mode, size, msg=None):
|
||||
if mode is not None:
|
||||
assert im.mode == mode, (
|
||||
msg or f"got mode {repr(im.mode)}, expected {repr(mode)}"
|
||||
msg or f"got mode {repr(im.mode)}, expected {repr(mode)}"
|
||||
)
|
||||
|
||||
if size is not None:
|
||||
assert im.size == size, (
|
||||
msg or f"got size {repr(im.size)}, expected {repr(size)}"
|
||||
msg or f"got size {repr(im.size)}, expected {repr(size)}"
|
||||
)
|
||||
|
||||
|
||||
|
@ -135,8 +133,8 @@ def assert_image_similar(a, b, epsilon, msg=None):
|
|||
ave_diff = diff / (a.size[0] * a.size[1])
|
||||
try:
|
||||
assert epsilon >= ave_diff, (
|
||||
(msg or "")
|
||||
+ f" average pixel value difference {ave_diff:.4f} > epsilon {epsilon:.4f}"
|
||||
(msg or "")
|
||||
+ f" average pixel value difference {ave_diff:.4f} > epsilon {epsilon:.4f}"
|
||||
)
|
||||
except Exception as e:
|
||||
if HAS_UPLOADER:
|
||||
|
@ -195,8 +193,8 @@ def mark_if_feature_version(mark, feature, version_blacklist, reason=None):
|
|||
version_required = parse_version(version_blacklist)
|
||||
version_available = parse_version(features.version(feature))
|
||||
if (
|
||||
version_available.major == version_required.major
|
||||
and version_available.minor == version_required.minor
|
||||
version_available.major == version_required.major
|
||||
and version_available.minor == version_required.minor
|
||||
):
|
||||
return mark(reason=reason)
|
||||
return pytest.mark.pil_noop_mark()
|
||||
|
|
Loading…
Reference in New Issue
Block a user