Pillow/test/test_image_tobitmap.py

25 lines
474 B
Python
Raw Normal View History

2014-06-05 13:26:54 +04:00
from helper import unittest, PillowTestCase, lena
from PIL import Image
class TestImage(PillowTestCase):
def test_sanity(self):
self.assertRaises(ValueError, lambda: lena().tobitmap())
assert_no_exception(lambda: lena().convert("1").tobitmap())
im1 = lena().convert("1")
bitmap = im1.tobitmap()
assert_true(isinstance(bitmap, bytes))
assert_image_equal(im1, fromstring(bitmap))
if __name__ == '__main__':
unittest.main()
# End of file