Pillow/Tests/test_image_tobitmap.py

17 lines
342 B
Python
Raw Normal View History

from __future__ import annotations
2020-02-12 19:29:19 +03:00
import pytest
2020-02-12 19:29:19 +03:00
from .helper import assert_image_equal, fromstring, hopper
2020-02-12 19:29:19 +03:00
def test_sanity():
with pytest.raises(ValueError):
hopper().tobitmap()
2020-02-12 19:29:19 +03:00
im1 = hopper().convert("1")
2014-06-10 13:10:47 +04:00
2020-02-12 19:29:19 +03:00
bitmap = im1.tobitmap()
assert isinstance(bitmap, bytes)
assert_image_equal(im1, fromstring(bitmap))