Pillow/Tests/test_font_bdf.py

19 lines
471 B
Python
Raw Normal View History

2020-01-27 14:46:52 +03:00
import pytest
from PIL import BdfFontFile, FontFile
filename = "Tests/images/courB08.bdf"
2020-01-27 14:46:52 +03:00
def test_sanity():
with open(filename, "rb") as test_file:
font = BdfFontFile.BdfFontFile(test_file)
2014-06-10 13:10:47 +04:00
2020-01-27 14:46:52 +03:00
assert isinstance(font, FontFile.FontFile)
assert len([_f for _f in font.glyph if _f]) == 190
2014-06-10 13:10:47 +04:00
2020-01-27 14:46:52 +03:00
def test_invalid_file():
with open("Tests/images/flower.jpg", "rb") as fp:
with pytest.raises(SyntaxError):
BdfFontFile.BdfFontFile(fp)