2019-01-13 20:00:12 +03:00
|
|
|
from .helper import unittest, PillowTestCase, hopper
|
2013-02-26 14:28:34 +04:00
|
|
|
|
|
|
|
from PIL import Image
|
|
|
|
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
class TestImageFromBytes(PillowTestCase):
|
2013-02-26 14:28:34 +04:00
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
def test_sanity(self):
|
2014-09-05 14:03:56 +04:00
|
|
|
im1 = hopper()
|
2014-06-10 13:10:47 +04:00
|
|
|
im2 = Image.frombytes(im1.mode, im1.size, im1.tobytes())
|
|
|
|
|
|
|
|
self.assert_image_equal(im1, im2)
|
|
|
|
|
2017-09-01 13:36:51 +03:00
|
|
|
def test_not_implemented(self):
|
|
|
|
self.assertRaises(NotImplementedError, Image.fromstring)
|
|
|
|
|
2014-06-10 13:10:47 +04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|