mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Changing StringIO to BytesIO
This commit is contained in:
parent
6d8ba56c44
commit
5577801aaa
|
@ -1,10 +1,7 @@
|
||||||
from tester import *
|
from tester import *
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
try:
|
from io import BytesIO
|
||||||
from io import StringIO # python 3
|
|
||||||
except ImportError:
|
|
||||||
from StringIO import StringIO # python 2
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PIL import ImageFont
|
from PIL import ImageFont
|
||||||
|
@ -22,7 +19,7 @@ def test_font_with_name():
|
||||||
|
|
||||||
def test_font_with_filelike():
|
def test_font_with_filelike():
|
||||||
font_name = "Tests/fonts/FreeMono.ttf"
|
font_name = "Tests/fonts/FreeMono.ttf"
|
||||||
font_filelike = StringIO.StringIO(open(font_name, 'rb').read())
|
font_filelike = BytesIO(open(font_name, 'rb').read())
|
||||||
font_size = 10
|
font_size = 10
|
||||||
assert_no_exception(lambda: ImageFont.truetype(font_filelike, font_size))
|
assert_no_exception(lambda: ImageFont.truetype(font_filelike, font_size))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user