Changing StringIO to BytesIO

This commit is contained in:
Nicolas Pieuchot 2013-04-25 21:45:12 +02:00
parent 6d8ba56c44
commit 5577801aaa

View File

@ -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))