mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Add integer range tests
This commit is contained in:
parent
ce204f47f4
commit
bc4b664b70
|
@ -153,7 +153,10 @@ def test_lifetime2() -> None:
|
||||||
|
|
||||||
class DataShape(NamedTuple):
|
class DataShape(NamedTuple):
|
||||||
dtype: Any
|
dtype: Any
|
||||||
elt: Any
|
elt: Any # Strictly speaking, this should be a pixel or pixel component,
|
||||||
|
# so list[uint8][4], float, int, uint32, uint8, etc.
|
||||||
|
# But more correctly, it should be exactly the dtype from the
|
||||||
|
# line above.
|
||||||
elts_per_pixel: int
|
elts_per_pixel: int
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,6 +178,12 @@ UINT32 = DataShape(
|
||||||
elts_per_pixel=1, # one per pixel
|
elts_per_pixel=1, # one per pixel
|
||||||
)
|
)
|
||||||
|
|
||||||
|
INT32 = DataShape(
|
||||||
|
dtype=pyarrow.uint32(),
|
||||||
|
elt=0x12CDEF45, # one packed int
|
||||||
|
elts_per_pixel=1, # one per pixel
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"mode, data_tp, mask",
|
"mode, data_tp, mask",
|
||||||
|
@ -215,6 +224,12 @@ def test_fromarray(mode: str, data_tp: DataShape, mask: list[int] | None) -> Non
|
||||||
("CMYK", UINT32, None),
|
("CMYK", UINT32, None),
|
||||||
("YCbCr", UINT32, [0, 1, 2]),
|
("YCbCr", UINT32, [0, 1, 2]),
|
||||||
("HSV", UINT32, [0, 1, 2]),
|
("HSV", UINT32, [0, 1, 2]),
|
||||||
|
("LA", INT32, [0, 3]),
|
||||||
|
("RGB", INT32, [0, 1, 2]),
|
||||||
|
("RGBA", INT32, None),
|
||||||
|
("CMYK", INT32, None),
|
||||||
|
("YCbCr", INT32, [0, 1, 2]),
|
||||||
|
("HSV", INT32, [0, 1, 2]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_from_int32array(mode: str, data_tp: DataShape, mask: list[int] | None) -> None:
|
def test_from_int32array(mode: str, data_tp: DataShape, mask: list[int] | None) -> None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user