mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
use hopper() for test_getdata_putdata()
This commit is contained in:
parent
fe79ae5653
commit
5573ec7490
|
@ -1036,17 +1036,7 @@ class TestImageBytes:
|
|||
|
||||
@pytest.mark.parametrize("mode", image_mode_names)
|
||||
def test_getdata_putdata(self, mode: str) -> None:
|
||||
# create an image with 1 pixel to get its pixel size
|
||||
im = Image.new(mode, (1, 1))
|
||||
pixel_size = len(im.tobytes())
|
||||
|
||||
# create a new image with incrementing byte values
|
||||
im = Image.new(mode, (2, 2))
|
||||
source_bytes = bytes(range(im.width * im.height * pixel_size))
|
||||
im.frombytes(source_bytes)
|
||||
|
||||
# copy the data from the previous image to a new image
|
||||
# and check that they are the same
|
||||
im = hopper(mode)
|
||||
reloaded = Image.new(mode, im.size)
|
||||
reloaded.putdata(im.getdata())
|
||||
assert_image_equal(im, reloaded)
|
||||
|
|
Loading…
Reference in New Issue
Block a user