mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-16 02:04:45 +03:00
[Test] add Image.fromarray LA mode test
inspired from Tests/test_image_frombytes.py
This commit is contained in:
parent
001bee40ab
commit
911bd0f7b2
22
Tests/test_image_fromarray_la.py
Normal file
22
Tests/test_image_fromarray_la.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from helper import unittest, PillowTestCase
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
class TestImageFromArrayLA(PillowTestCase):
|
||||||
|
|
||||||
|
def test_sanity(self):
|
||||||
|
ar1 = (np.random.random((40,40,2))*255).astype('uint8')
|
||||||
|
im1 = Image.fromarray(ar1)
|
||||||
|
arr = np.array(im1.getdata(), 'uint8')
|
||||||
|
ar2 = arr.reshape(im1.size[1], im1.size[0], arr.shape[1])
|
||||||
|
im2 = Image.fromarray(ar2)
|
||||||
|
|
||||||
|
self.assert_image_equal(im1, im2)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
|
# End of file
|
Loading…
Reference in New Issue
Block a user