From 911bd0f7b2384015ee546a67bc91eb3b47faca46 Mon Sep 17 00:00:00 2001 From: Pierrick Koch Date: Wed, 27 Apr 2016 16:00:48 +0200 Subject: [PATCH] [Test] add Image.fromarray LA mode test inspired from Tests/test_image_frombytes.py --- Tests/test_image_fromarray_la.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Tests/test_image_fromarray_la.py diff --git a/Tests/test_image_fromarray_la.py b/Tests/test_image_fromarray_la.py new file mode 100644 index 000000000..15931b16d --- /dev/null +++ b/Tests/test_image_fromarray_la.py @@ -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