mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-01 10:23:34 +03:00
lint
This commit is contained in:
parent
c729d4e208
commit
ac500460df
|
@ -9,8 +9,8 @@ from PIL import Image
|
||||||
from .helper import (
|
from .helper import (
|
||||||
assert_deep_equal,
|
assert_deep_equal,
|
||||||
assert_image_equal,
|
assert_image_equal,
|
||||||
is_big_endian,
|
|
||||||
hopper,
|
hopper,
|
||||||
|
is_big_endian,
|
||||||
)
|
)
|
||||||
|
|
||||||
pyarrow = pytest.importorskip("pyarrow", reason="PyArrow not installed")
|
pyarrow = pytest.importorskip("pyarrow", reason="PyArrow not installed")
|
||||||
|
@ -37,7 +37,10 @@ def _test_img_equals_pyarray(
|
||||||
if elts_per_pixel == 1:
|
if elts_per_pixel == 1:
|
||||||
assert pixel[ix] == arr[y * img.width + x].as_py()[elt]
|
assert pixel[ix] == arr[y * img.width + x].as_py()[elt]
|
||||||
else:
|
else:
|
||||||
assert pixel[ix] == arr[(y * img.width + x) * elts_per_pixel + elt].as_py()
|
assert (
|
||||||
|
pixel[ix]
|
||||||
|
== arr[(y * img.width + x) * elts_per_pixel + elt].as_py()
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
assert_deep_equal(px[x, y], arr[y * img.width + x].as_py())
|
assert_deep_equal(px[x, y], arr[y * img.width + x].as_py())
|
||||||
|
|
||||||
|
@ -175,24 +178,18 @@ INT32 = (
|
||||||
("LA", UINT, [0, 3]),
|
("LA", UINT, [0, 3]),
|
||||||
("RGB", UINT_ARR, [0, 1, 2]),
|
("RGB", UINT_ARR, [0, 1, 2]),
|
||||||
("RGBA", UINT_ARR, None),
|
("RGBA", UINT_ARR, None),
|
||||||
("RGBA", UINT_ARR, None),
|
|
||||||
("CMYK", UINT_ARR, None),
|
("CMYK", UINT_ARR, None),
|
||||||
("YCbCr", UINT_ARR, [0, 1, 2]),
|
("YCbCr", UINT_ARR, [0, 1, 2]),
|
||||||
("HSV", UINT_ARR, [0, 1, 2]),
|
("HSV", UINT_ARR, [0, 1, 2]),
|
||||||
("RGB", UINT, [0, 1, 2]),
|
("RGB", UINT, [0, 1, 2]),
|
||||||
("RGBA", UINT, None),
|
("RGBA", UINT, None),
|
||||||
("RGBA", UINT, None),
|
|
||||||
("CMYK", UINT, None),
|
("CMYK", UINT, None),
|
||||||
("YCbCr", UINT, [0, 1, 2]),
|
("YCbCr", UINT, [0, 1, 2]),
|
||||||
("HSV", UINT, [0, 1, 2]),
|
("HSV", UINT, [0, 1, 2]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_fromarray(mode: str,
|
def test_fromarray(mode: str, data_tp: tuple, mask: list[int] | None) -> None:
|
||||||
data_tp: tuple,
|
(dtype, elt, elts_per_pixel) = data_tp
|
||||||
mask:list[int] | None) -> None:
|
|
||||||
(dtype,
|
|
||||||
elt,
|
|
||||||
elts_per_pixel) = data_tp
|
|
||||||
|
|
||||||
ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1]
|
ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1]
|
||||||
arr = pyarrow.array([elt] * (ct_pixels * elts_per_pixel), type=dtype)
|
arr = pyarrow.array([elt] * (ct_pixels * elts_per_pixel), type=dtype)
|
||||||
|
@ -207,18 +204,13 @@ def test_fromarray(mode: str,
|
||||||
("LA", INT32, [0, 3]),
|
("LA", INT32, [0, 3]),
|
||||||
("RGB", INT32, [0, 1, 2]),
|
("RGB", INT32, [0, 1, 2]),
|
||||||
("RGBA", INT32, None),
|
("RGBA", INT32, None),
|
||||||
("RGBA", INT32, None),
|
|
||||||
("CMYK", INT32, None),
|
("CMYK", INT32, None),
|
||||||
("YCbCr", INT32, [0, 1, 2]),
|
("YCbCr", INT32, [0, 1, 2]),
|
||||||
("HSV", INT32, [0, 1, 2]),
|
("HSV", INT32, [0, 1, 2]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_from_int32array(mode: str,
|
def test_from_int32array(mode: str, data_tp: tuple, mask: list[int] | None) -> None:
|
||||||
data_tp: tuple,
|
(dtype, elt, elts_per_pixel) = data_tp
|
||||||
mask:list[int] | None) -> None:
|
|
||||||
(dtype,
|
|
||||||
elt,
|
|
||||||
elts_per_pixel) = data_tp
|
|
||||||
|
|
||||||
ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1]
|
ct_pixels = TEST_IMAGE_SIZE[0] * TEST_IMAGE_SIZE[1]
|
||||||
arr = pyarrow.array([elt] * (ct_pixels * elts_per_pixel), type=dtype)
|
arr = pyarrow.array([elt] * (ct_pixels * elts_per_pixel), type=dtype)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user