2023-12-21 14:13:31 +03:00
|
|
|
from __future__ import annotations
|
2024-01-20 14:23:03 +03:00
|
|
|
|
2020-01-27 14:46:52 +03:00
|
|
|
import pytest
|
2020-08-07 13:28:33 +03:00
|
|
|
|
2019-07-06 23:40:53 +03:00
|
|
|
from PIL import BdfFontFile, FontFile
|
2012-10-16 00:26:38 +04:00
|
|
|
|
2014-06-23 10:19:29 +04:00
|
|
|
filename = "Tests/images/courB08.bdf"
|
2012-10-16 00:26:38 +04:00
|
|
|
|
|
|
|
|
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)
|