Pillow/test/test_image_tobitmap.py

23 lines
465 B
Python
Raw Normal View History

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