File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import io
4+
35import pytest
46
57from PIL import BdfFontFile , FontFile
810
911
1012def test_sanity () -> None :
11- with open (filename , "rb" ) as test_file :
12- font = BdfFontFile .BdfFontFile (test_file )
13+ with open (filename , "rb" ) as fp :
14+ font = BdfFontFile .BdfFontFile (fp )
1315
1416 assert isinstance (font , FontFile .FontFile )
1517 assert len ([_f for _f in font .glyph if _f ]) == 190
1618
1719
20+ def test_valueerror () -> None :
21+ with open (filename , "rb" ) as fp :
22+ data = fp .read ()
23+ data = data [:2650 ] + b"\x00 \x00 " + data [2652 :]
24+ BdfFontFile .BdfFontFile (io .BytesIO (data ))
25+
26+
1827def test_invalid_file () -> None :
1928 with open ("Tests/images/flower.jpg" , "rb" ) as fp :
2029 with pytest .raises (SyntaxError ):
You can’t perform that action at this time.
0 commit comments