Adjust code for ruff-format style

This commit is contained in:
Aarni Koskela 2023-10-30 20:14:30 +02:00
parent a7fe25df53
commit a6d7884b90
5 changed files with 13 additions and 17 deletions

View File

@ -119,8 +119,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}"
f"{msg or ""} average pixel value difference "
f"{ave_diff:.4f} > epsilon {epsilon:.4f}"
)
except Exception as e:
if HAS_UPLOADER:

View File

@ -546,9 +546,7 @@ class TestFileJpeg:
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 92 95 98 112 100 103 99
""".split(
None
)
""".split(None)
]
standard_chrominance_qtable = [
@ -562,9 +560,7 @@ class TestFileJpeg:
99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99
""".split(
None
)
""".split(None)
]
# list of qtable lists
assert_image_similar(

View File

@ -13,7 +13,10 @@ class TestTTypeFontLeak(PillowLeakTestCase):
draw = ImageDraw.ImageDraw(im)
self._test_leak(
lambda: draw.text(
(0, 0), "some text " * 1024, font=font, fill="black" # ~10k
(0, 0),
"some text " * 1024, # ~10k
font=font,
fill="black",
)
)

View File

@ -228,9 +228,7 @@ class TestImageGetPixel(AccessTest):
assert im.getpixel([0, 0]) == (20, 20, 70)
@pytest.mark.parametrize("mode", ("I;16", "I;16B"))
@pytest.mark.parametrize(
"expected_color", (2**15 - 1, 2**15, 2**15 + 1, 2**16 - 1)
)
@pytest.mark.parametrize("expected_color", (2**15 - 1, 2**15, 2**15 + 1, 2**16 - 1))
def test_signedness(self, mode, expected_color):
# see https://github.com/python-pillow/Pillow/issues/452
# pixelaccess is using signed int* instead of uint*

View File

@ -52,7 +52,6 @@ if sys.platform == "win32" and sys.version_info >= (3, 13):
)
)
_IMAGING = ("decode", "encode", "map", "display", "outline", "path")
_LIB_IMAGING = (
@ -418,11 +417,11 @@ class pil_build_ext(build_ext):
)
except Exception:
sdk_path = None
if (
not sdk_path
or sdk_path == "/Applications/Xcode.app/Contents/Developer"
xcode_sdk_path = (
"/Applications/Xcode.app/Contents/Developer"
"/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
):
)
if not sdk_path or sdk_path == xcode_sdk_path:
commandlinetools_sdk_path = (
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
)