Fixing the tests on py 3.x

This commit is contained in:
wiredfool 2016-03-16 10:03:38 +00:00
parent c6ec3be0d6
commit f65fcf7274

View File

@ -1,6 +1,6 @@
from helper import unittest, PillowTestCase from helper import unittest, PillowTestCase
from PIL import ImagePath from PIL import ImagePath, Image
import array import array
import struct import struct
@ -69,18 +69,21 @@ class TestImagePath(PillowTestCase):
# This fails due to the invalid malloc above, # This fails due to the invalid malloc above,
# and segfaults # and segfaults
for i in xrange(200000): for i in range(200000):
x[i] = "0"*16 if str is bytes:
x[i] = "0"*16
else:
x[i] = b'0'*16
except MemoryError as msg: except MemoryError as msg:
self.assertTrue(msg) self.assertTrue(msg)
except: except:
self.asserTrue(False, "Should have received a memory error") self.assertTrue(False, "Should have received a memory error")
class evil: class evil:
def __init__(self): def __init__(self):
self.corrupt = ImagePath.Path(0x4000000000000000) self.corrupt = Image.core.path(0x4000000000000000)
def __getitem__(self, i): def __getitem__(self, i):
x = self.corrupt[i] x = self.corrupt[i]